Re: Regular Expression

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance





asadikhan@xxxxxxxxx wrote:
> Hi,
>
> I want to create a regular expression. I have come up with something
> like this:
>
> Scan*ValRel(QualValRel)*
>
> which basically means that I should see:
>
> zero or more of "Scan"
> exactly one of "Val"
> exactly one of "Rel"
> zero or more of "ScanValRel"
>
> however I can't seem to get this right. I used Expresso as well to try
> to come up with the right expression. The closest I got was:
>
> (Scan)*(Val)(Rel)(QualValRel)*
>
> but this allows
>
> ScanValValRel (as it finds ValRel as part of this string). I don't want
> it to do that.
>
> As specified above, I want to find exactly one of Val (no more) etc.
>
> How do I do this?

Simply put ^ and $ at the start and end (respectively) of your pattern,
to require that the *whole* of the input string matches the *whole* of
the pattern

--
Larry Lard
Replies to group please

.



Relevant Pages

  • Regular Expression
    ... I want to create a regular expression. ... zero or more of "ScanValRel" ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Regular Expression help
    ... I want to create a regular expression. ... zero or more of "ScanValRel" ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: re.sub(): replace longest match instead of leftmost match?
    ... Typically this means that your regular expression is not specific ... Zero or more blocks containing (zero to two groups of zero followed by ... zeroes followed by zero or more blocks containing (a non-zero group ...
    (comp.lang.python)
  • Re: Extract domain names out of URLs
    ... Match the regular expression below and capture its match into backreference ... Between zero and one times, as many times as possible, giving back as needed ... A character in the range between ?A? ...
    (microsoft.public.excel)
  • Regular expressions
    ... The regular expression ... Either the word 10 OR the word 0 followed by zero or more 0s followed by the ... "execute" first, might someobdy explain them with a few examples perhaps, ... What do I have to take care for? ...
    (comp.theory)