Re: Decoding Regular Expression
- From: daggerquill@xxxxxxxxx (Jay Savage)
- Date: Wed, 29 Jun 2005 16:28:49 -0400
On 6/28/05, Shilpa Arvind <shilparvind@xxxxxxxxxxx> wrote:
> Hi,
>
> I am having trouble understanding this regular expression. Any help on this
> is greatly appreciated.
>
> open FILE, "xyz";
> while (<FILE>)
> {
> undef($regexp_var);
> ($regexp_var) = ($_ =~
> /(\"(\\\"|[^\"])+\")/);
> s/(\"(\\\"|[^\"])+\")// if (defined
> $regexp_var);
> }
> What does \" do. (Quotes) " does not require blackslash but here it is used
> with blackslash. What does this do.
>
> Shilpa
>
>
>
Can you give us a little more context? Where did you get this from?
what it the script it's part of supposed to do?
The thing that jumps immediately to mind are 1) it was originally a
one-liner, and these are shell escapes, 2) it's a deliberate
obfuscation from perlmonks or someplace similar, 3) the original
delimiter was something else, and these are all literal backslashes,
or 4) the person who did this wasn't a very good coder, or was used to
using sed.
Actually 4 is obviously true, unless this is a deliberate obfuscation:
why perform the match and then the substition if the match is
successful? Just using s/// would have been more than adequate: it
can't substitute if it doesn't match.
Right now, it just looks like a really awkward way to delete a windows
path. Where *did* you dig this up?
-- jay
--------------------
daggerquill [at] gmail [dot] com
http://www.tuaw.com
http://www.dpguru.com
http://www.engatiki.org
.
- References:
- Decoding Regular Expression
- From: Shilpa Arvind
- Decoding Regular Expression
- Prev by Date: Re: perl message passing module
- Next by Date: Re: Parsing Data
- Previous by thread: Re: Decoding Regular Expression
- Next by thread: Interactive with other program
- Index(es):