Re: Simple Regular Expression.

From: EFP (epridgett_at_woh.rr.com)
Date: 12/01/03


Date: 1 Dec 2003 10:50:07 -0800

Based upon your expression I'm still not sure how it works. You have
the first ".*" which says 0 or more periods. Then you escape the slash
to look for a "\" then the "(.+)" match 1 or more periods and then you
escape both @@'s individually. So I still don't understand how the
".*" and the "(.+)" are used. Also, how does this say give me the
contents between the \ and the @@. I have read the reference pages
before and after this post. Could you shed some light on the
reasoning? I'm sure once you explain it regular expression will be
easier to comprehend.

.\Source\CPP\ConnPool\src\oraUtils.pc@@ (source)

Thanks

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<3S4xb.39420$dP1.146947@newsc.telia.net>...
> EFP wrote:
> > Sample Units.txt data:
> > .\Source\CPP\ConnPool\src\oraUtils.pc@@
>
> <snip>
>
> > I just want the:
> > oraUtils.pc
>
> <snip>
>
> > So basically I want the contents between "\" and the "@@"
> >
> > I thought that:
> > $string =~ m/\*@@\$/;
> >
> > Would go to the end of the search line and find "@@" and get
> > anything "*" between the "@@" and the "\" and set $string to this
> > new value.
>
> What on earth made you think that??
>
> > Can anyone correct my understanding of regular expression and
> > assignment to a varibale.
>
> Yes, you can do that. By studying the Perl documentation for regular
> expressions:
>
> http://www.perldoc.com/perl5.8.0/pod/perlre.html
>
> This would do what you want:
>
> ($string) = $string =~ /.*\\(.+)\@\@/;
>
> But please use the docs to get an understanding of how it works.



Relevant Pages

  • Re: MySQL to SQL
    ... I've cut out the bottom part of the MySQL script. ... Dim data: data = WScript.StdIn.ReadLine ... If we JUST want to escape HOST_NAME, ... as our "regular expression" and thus insert this ...
    (microsoft.public.scripting.wsh)
  • Re: Help: How can I parse this properties file?
    ... Recently I need read in a proerties file, ... and it uses \ to escape. ... So yes there is a regular expression to do that. ... Where does this sequence take you? ...
    (comp.lang.perl.misc)
  • Re: MySQL to SQL
    ... If we JUST want to escape HOST_NAME, ... Do you have any "real" backslash characters in the data somewhere - I mean, ... as our "regular expression" and thus insert this ... Outlook Express strips off the quotes on the pattern, ...
    (microsoft.public.scripting.wsh)
  • Re: converting code via regex
    ... my $wordCNT = 0; ... No need to escape most of that in the replacement part, ... characters are only special in a regular expression (the left-hand ... use warnings; ...
    (comp.lang.perl.misc)
  • Re: Regular Expression error
    ... It's true that special characters have to be escaped, ... escaped, ... :> I have one script of Regular Expression on two ASP-pages, ...
    (microsoft.public.scripting.vbscript)