List Info

Thread: REGEX PROBLEM URGENT




REGEX PROBLEM URGENT
country flaguser name
United States
2007-06-21 15:57:12
Hello,

I need help with a regular expression

the search text is as folows:

-LHR010Y-PAD100

A quick breakdown LHR is airport code which has to be 3
chars
010 is a number which can be 2-3 digits long
-PAD is literal string
and the 100 after it is a number which can be 1-3 digits
long

I know how to do the regex if i split the string in two but
the
problem is i can't
get the regex right for the whole expression. You see the
-PAD100 is
optional
but the -LHR010Y is the mandatory part of the expression. An
Example
-LHR010Y  - valid
-LHR010Y-PAD100 valid
-LHR010Y-             invalid
LHR010Y-PAD     invalid

i can't get it to not match when the second part is invalid.
It always
still matches the first
part. HELP i need to get this right. How do you force a non
match when
the second
half of the search text does not match the second part of
your regex?

Regards

Romeel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: REGEX PROBLEM URGENT
user name
2007-06-21 20:05:53


On 6/22/07, Romeel < romeel_kyahoo.co.uk">romeel_kyahoo.co.uk> wrote:

How do you force a non match when
the second
half of the search text does not match the second part of your regex?

You can try with '*'; modifier. For example:

/(first+)(second*)/

The second will be optional.

--
http://visit.aryosanjaya.net/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )