Eduardo M KALINOWSKI wrote on Sat, 24 Apr 2010 10:19:58 -0300.
> On 04/23/2010 09:11 PM, Always Learning wrote:
>> [a](1) = match only one 'a'
> No, that would match an 'a', followed by a '1', storing the 1 in a
> matched group. To specify the number of matches one uses curly braces:
> {1}. However, it is redundant to specify {1}: if you want exactly one
> match, just specify what you want matched. "[a]{1}" and "[a]" are the same.
>
> Furthermore, [...] means one of the characters inside the brackets:
> "[ab]" is either a or b. If there is only one character, there is no
> need for brackes: just specify them.
>
> In short, to match one 'a', use "a".
Thank you for explaning the {1}.
>> [-_.](?) = match next character which should be one or nil occurrences
>> of .-_
> To match zero or one of an expression, use "?", not "(?)" (which is
> seems like an illegal regexp - I wonder how it gets parsed). And I
> believe you meant one or nil of one of the characters .-_
Would one use [-_.]{?}, being similar to [a]{2}, rather than only [-_.]?
or is '?' a special character in RegExp ?
> While to geared towards exim, these tutorials are quite useful:
> http://perldoc.perl.org/perlrequick.html
> http://perldoc.perl.org/perlretut.html
>
> Or google "regexp tutorial", there's bound to be dozens of useful resources.
I'll read them as soon as I can. Thank you for the URLs.
Regards,
Paul.
--