Re: Regular Expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kaushal Shriyan wrote:
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.


"." matches any character and must be escaped; "\."
which may need to be escaped further depending how
it's being passed (for example shell expansions and
C \ escapes).  Note that this will successfully match
a string which contains any of your examples on its
own line (simply matching will still pass even if
there is content separated from your string by a
line break). + means 1 or more; is this what you wanted
with "200[0-9]+"?  "2[0-9]{3}" makes more sense
(depending on how future proof you want it).

grep will not understand "+" or {3} unless run with
the -E argument.

O.T.: I notice the list "Ubuntu user technical support,
not for general discussions" is probably not
appropriate.

--
imalone


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux