Re: Assigning regexpression to a variable
From: John W. Krahn (krahnj_at_telus.net)
Date: 10/29/04
- Next message: Zeus Odin: "Re: Printing to a file"
- Previous message: Bob Showalter: "RE: Get all mail addresses from a domain"
- Maybe in reply to: Prabahar Mosas: "Assigning regexpression to a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 05:42:48 -0700 To: Perl Beginners <beginners@perl.org>
Prabahar Mosas wrote:
>
> On Fri, 29 Oct 2004 John W.Krahn wrote :
>
>>Prabahar Mosas wrote:
>>>
>>>specimen coding
>>>**************
>>>$value = 2422; $reg = '/\d/';
>>
>>The slashes (/) are the delimiters for the match operator, they
> are not a part of the regular expression, just like the quotes
> (') delimit the string but are not a part of it. Your "regular
> expression" says match a '/' character followed by a '\d' character
> followed by a '/' character.
>
> I agree your point. But that is simple regular expression.
> When I assign complex regular expressions into a variable it won't
> assign.
>
> eg $regex = 's/[A-Z]/[a-z]/g';
That is matching every *single* character in the range A-Z and replacing
*each* *character* with the *string* '[a-z]'.
> $regex = 's/\r//g';
> $regex = '/(^[^a-z])|/|(\.\.)/i'
> For this case What I need to do for that Mail me. Because this Problem is
> one of the barrier in my project.
It looks like you may be confused between a regular expression, which is
similar to a string, and the match, substitution and transliteration
operators, two of which use regular expressions. Have you read some of the
documentation on regular expressions and strings?
perldoc perlrequick
perldoc perlretut
perldoc perlre
perldoc perlop
perldoc perlreref
If you still think you need to do the above then:
perldoc -q "How do I match a pattern that is supplied by the user"
perldoc -f eval
John
-- use Perl; program fulfillment
- Next message: Zeus Odin: "Re: Printing to a file"
- Previous message: Bob Showalter: "RE: Get all mail addresses from a domain"
- Maybe in reply to: Prabahar Mosas: "Assigning regexpression to a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|