Regular Expressions
Matthew Flaschen
matthew.flaschen at gatech.edu
Tue May 29 05:14:19 UTC 2007
Bill Marcum wrote:
> ["Followup-To:" header set to gmane.linux.ubuntu.user.]
> On Sun, 27 May 2007 21:27:26 +0530, Kaushal Shriyan
> <kaushalshriyan at gmail.com> wrote:
>> --===============0458939522==
>> Content-Type: multipart/alternative;
>> boundary="----=_Part_23939_32956483.1180281446204"
>>
>> Hi
>>
>> I have created a regex for the below smb URLs
>>
>> smb://ab-03.nea.nl/RegSec/Arch2006/Wanders/
>> smb://ab-03.nea.nl/RegSec/Arch2006/Wdivers/
>> smb://ab-03.nea.nl/RegSec/Arch2006/Wofferte/
>> smb://ab-03.nea.nl/RegSec/Arch2006/Wrapport/
>> smb://ab-03.nea.nl/RegSec/Arch2005/Wanders/
>> smb://ab-03.nea.nl/RegSec/Arch2005/Wdivers/
>> smb://ab-03.nea.nl/RegSec/Arch2005/Wofferte/
>> smb://ab-03.nea.nl/RegSec/Arch2005/Wrapport/
>>
>> regex:^smb://ab-03.nea.nl/RegSec/Arch200[0-9]+/W[a-z]+/$
>>
>> is there a way to check whether my regex is valid and I am sure i am missing
>> something. Please correct me if my regex is wrong.
You have to escape the periods, because period means any character in regex.
So:
regex:^smb://ab-03\.nea\.nl/RegSec/Arch200[0-9]+/W[a-z]+/$
There may be other problems. For example, why is there a + after [0-9].
Surely, 20057 is not a particularly valid year.
Matt Flaschen
More information about the ubuntu-users
mailing list