473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

RegEx Help

I'd like to write a RegEx that validates the format of a file name

- The first two letters should be "dc" or "iq"
- Followed by a period
- Any six integers
- Followed by a period
- The letters "lw", or "cw"
- Followed by ".txt"

Valid examples for the file names are

dc.050277.lw.txt
dc.050277.cw.txt
iq.050277.lw.txt
iq.050277.cw.txt

I appreciate your help
Nov 19 '05 #1
2 929
hahah..That's a funny requirement for some reason :)

try

(dc|iq)\.\d{6}\.(lw|cw)\.txt

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"George Durzi" <gd****@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
I'd like to write a RegEx that validates the format of a file name

- The first two letters should be "dc" or "iq"
- Followed by a period
- Any six integers
- Followed by a period
- The letters "lw", or "cw"
- Followed by ".txt"

Valid examples for the file names are

dc.050277.lw.txt
dc.050277.cw.txt
iq.050277.lw.txt
iq.050277.cw.txt

I appreciate your help

Nov 19 '05 #2
Thanks Karl :)

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl...
hahah..That's a funny requirement for some reason :)

try

(dc|iq)\.\d{6}\.(lw|cw)\.txt

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"George Durzi" <gd****@hotmail.com> wrote in message
news:u4**************@TK2MSFTNGP09.phx.gbl...
I'd like to write a RegEx that validates the format of a file name

- The first two letters should be "dc" or "iq"
- Followed by a period
- Any six integers
- Followed by a period
- The letters "lw", or "cw"
- Followed by ".txt"

Valid examples for the file names are

dc.050277.lw.txt
dc.050277.cw.txt
iq.050277.lw.txt
iq.050277.cw.txt

I appreciate your help


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: leegold2 | last post by:
I'm new to PHP regex. What I am trying to match is: http://library.dayton.town.net it's a mysql/php field. Then if a match I take some action. But it's not working any help appreciated....
8
by: Bibe | last post by:
I've been trying to get this going for awhile now, and need help. I've done a regex object, and when I use IsMatch, it's behavior is quite weird. I am trying to use Regex to make sure that a...
2
by: John Baro | last post by:
I need to determine when multiple fonts are selected in a richtextbox. A font is indicated by \fcharset(N) where (N) is a number. (To the best of my knowledge) I can use this statement int...
6
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
8
by: rh0dium | last post by:
Hi all, I am using python to drive another tool using pexpect. The values which I get back I would like to automatically put into a list if there is more than one return value. They provide me...
2
by: Alex Maghen | last post by:
This is a bit of an abuse of this group. Just a nit, but I'm hoping someone really good with Regular Expressions can help me out here. I need to write a regular expression that will do the...
4
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: ...
0
by: Support Desk | last post by:
That’s it exactly..thx -----Original Message----- From: Reedick, Andrew Sent: Tuesday, June 03, 2008 9:26 AM To: Support Desk Subject: RE: regex help The regex will now skip anything with...
4
by: Support Desk | last post by:
Anybody know of a good regex to parse html links from html code? The one I am currently using seems to be cutting off the last letter of some links, and returning links like http://somesite.co ...
2
by: Support Desk | last post by:
I am working on a python webcrawler, that will extract all links from an html page, and add them to a queue, The problem I am having is building absolute links from relative links, as there are so...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.