Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: advanced regEx

by polettix (Vicar)
on Nov 02, 2005 at 13:37 UTC ( [id://504914]=note: print w/replies, xml ) Need Help??


in reply to advanced regEx

What the output is ?
I'll skip this one - it takes nothing to put the text inside a text file, and execute it using the Perl interpreter. perlrun can help you with this, anyway.
Explanation ?
For regex in general, the main reference is perlre, but a look to perlretut is worth a look as well. In your case, perlop is also a good starting point, in particular the "Regexp Quote-Like Operators".

In general, the "s/SOMETHING/OTHER/" construct makes substitutions. Wherever it finds "SOMETHING", it puts "OTHER". In this case, this substitution operator is applied to the $value variable, via the =~ binding operator. This can be found in perlop, of course.

The "e" switch indicates that the "OTHER" (i.e. the 'pack("C", hex($1))' in your case) is to be considered an expression and not a pure sequence of characters, and the "g" switch indicates that the substitution has to be applied to every occurence of the text matched in the first "SOMETHING" part (i.e. the '%(..)' in your case). Globally, this seems born to replace every occurrence of "%XX" with the character whose hexadecimal representation is "XX".

Could any one help me .......
A whole lot is willing to help you here. But please take a look around, and in particular to the About the PerlMonks FAQ and How do I post a question effectively?. You forgot to use proper code tagging, and forced a janitor to do it for you. Welcome to the Monastery!

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

Replies are listed 'Best First'.
Re^2: advanced regEx
by jithoosin (Scribe) on Nov 05, 2005 at 11:35 UTC
    hi frodo......thanks for the help....the explanation was simple awesome & amazing......especially the "e" switch.......i now find that the expression was "ADVANCED REGEX" only for me and not for you people...and i have to learn a lot...........................i am kiran from india...thanks for spending your precious time to help newbies like me.....
      I'm going to post this here instead of using private message because I hope other people see it.

      Please, in the future, take some time to actually properly format your messages. This makes it much easier for everyone else who uses the site to read it. For example, you don't capitalize the first letter of your sentences and you over use periods. Periods should be singular and used to denote the end of the sentence. Please do not put long strings of them between your sentences. I realize typing like that may be "easier" for you, but it's a really arrogant form of laziness, as it makes it much harder for everyone else who has to decipher it.
        Thanks. I will take care.

        But my intention of putting long strings of periods was that the viewer will be able to differntiate between sentences as i dont usually use CAPS. The reason is my left SHIFT key in keyboard is not working. That means i either has to go for RIGHT shift or toggle CAPS LOCK key each time.

        As i have learned type writing this procedure is very difficult. As i donot have a job (completed engineering )now i cannot ask my dad to buy a new keyboard for me.

        Still in future i will take effort to make it better viewable by using RIGHT SHIFT & CAPS LOCK.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found