RE: Simple regex question

2009-05-19 Thread Ajay Kumar
: beginners@perl.org Subject: Re: Simple regex question You wrote on 05/19/2009 03:18 PM: > Simple question for the regEXperts out there... > > I have a string that is always in the format: a.nn+x.y > > a is always 5 chars > n can be 1 or 2 digits > x can be +/- (with sign), 1-4

Re: Simple regex question

2009-05-19 Thread John W. Krahn
Dan Fish wrote: Simple question for the regEXperts out there... I have a string that is always in the format: a.nn+x.y a is always 5 chars [a-zA-Z0-9]{5} n can be 1 or 2 digits [0-9]{1,2} x can be +/- (with sign), 1-4 digits [-+][0-9]{1,4} y is always positive (no sign), 1

Re: Simple regex question

2009-05-19 Thread John W. Krahn
Chas. Owens wrote: On Tue, May 19, 2009 at 09:55, Alexander Koenig wrote: snip ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; snip As of Perl 5.8 \d no longer matches [0-9]. ^ As of Perl 5.8 \d no longer matches only [0-9].

Re: Simple regex question

2009-05-19 Thread John W. Krahn
Dan Fish wrote: Simple question for the regEXperts out there... I have a string that is always in the format: a.nn+x.y a is always 5 chars [a-zA-Z0-9]{5} n can be 1 or 2 digits [0-9]{1,2} x can be +/- (with sign), 1-4 digits [-+][0-9]{1,4} y is always positive (no sign), 1

Re: Simple regex question

2009-05-19 Thread Chas. Owens
On Tue, May 19, 2009 at 10:21, Alexander Koenig wrote: > Chas. Owens wrote on 05/19/2009 04:02 PM: > >>> ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; >> snip >> >> As of Perl 5.8 \d no longer matches [0-9].  It now matches any UNICODE >> character that has the digit propert

Re: Simple regex question

2009-05-19 Thread Alexander Koenig
Chas. Owens wrote on 05/19/2009 04:02 PM: >> ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; > snip > > As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE > character that has the digit property. This includes characters such > as "\x{1815}" (MONGOLIAN DI

RE: Simple regex question

2009-05-19 Thread Dan Fish
> > Simple question for the regEXperts out there... > > > > I have a string that is always in the format:  a.nn+x.y > > > > a is always 5 chars > > n can be 1 or 2 digits > > x can be +/- (with sign), 1-4 digits > > y is always positive (no sign), 1-4 digits > snip > > What do you mean by char

RE: Simple regex question

2009-05-19 Thread Andrew Curry
A crude one ($part,$unit,$x,$y,$xlen,$ylen) = ($1,$2,$3,length($4),length($5)) if ($string =~ /(^\S{5})\.(\d{2})([+-])(\d+)\.(\d+)$/); -Original Message- From: Dan Fish [mailto:d...@ninemoons.com] Sent: 19 May 2009 14:18 To: beginners@perl.org Subject: Simple regex question Simple que

Re: Simple regex question

2009-05-19 Thread Chas. Owens
On Tue, May 19, 2009 at 09:55, Alexander Koenig wrote: snip > ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; snip As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE character that has the digit property. This includes characters such as "\x{1815}" (MONGO

Re: Simple regex question

2009-05-19 Thread Chas. Owens
On Tue, May 19, 2009 at 09:18, Dan Fish wrote: > Simple question for the regEXperts out there... > > I have a string that is always in the format:  a.nn+x.y > > a is always 5 chars > n can be 1 or 2 digits > x can be +/- (with sign), 1-4 digits > y is always positive (no sign), 1-4 digits snip

Re: Simple regex question

2009-05-19 Thread Alexander Koenig
You wrote on 05/19/2009 03:18 PM: > Simple question for the regEXperts out there... > > I have a string that is always in the format: a.nn+x.y > > a is always 5 chars > n can be 1 or 2 digits > x can be +/- (with sign), 1-4 digits > y is always positive (no sign), 1-4 digits The best I ca

Re: Simple regex problem has me baffled

2009-01-27 Thread Gunnar Hjalmarsson
Bill Harpley wrote: Hi Gunnar, I tried your suggestions but had no luck :-( (1) I tried your idea of using a paragraph separator local $/ = ''; # paragraph mode while ( my $entry = ) { if ( $entry =~ /\[([a-z0-9]{5})]/ ) { print "$1\n";

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
Can you explain why this works but my orginal effort did not? Many thanks, Bill Harpley -Original Message- From: Rob Dixon [mailto:rob.di...@gmx.com] Sent: Monday, January 26, 2009 7:19 PM To: Perl Beginners Cc: Bill Harpley Subject: Re: Simple regex problem has me baffled Bill Harple

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
each record into a single long line before trying to perform regex match? Is there an easy way to do this? Regards, Bill Harpley -Original Message- From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc] Sent: Monday, January 26, 2009 5:22 PM To: beginners@perl.org Subject: Re: Simple re

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
it:]] but to no avail So I remain stuck at square one !! Regards, Bill -Original Message- From: John W. Krahn [mailto:jwkr...@shaw.ca] Sent: Monday, January 26, 2009 5:20 PM To: Perl Beginners Subject: Re: Simple regex problem has me baffled Bill Harpley wrote: > Hello, He

RE: Simple regex problem has me baffled

2009-01-27 Thread Bill Harpley
uch as 'print "$1\n";' in other scripts. Regards, Bill Harpley -Original Message- From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca] Sent: Monday, January 26, 2009 4:32 PM To: Bill Harpley Cc: beginners@perl.org Subject: Re: Simple regex problem has

Re: Simple regex problem has me baffled

2009-01-26 Thread Rob Dixon
Bill Harpley wrote: > Hello, > > I have simple regex problem that is driving me crazy. > > I am writing a script to analyse a log file. It contains Java related > information about requests and responses. > > Each pair of Request (REQ) and Response (RES) calls have a unique > Request ID. This is

Re: Simple regex problem has me baffled

2009-01-26 Thread Gunnar Hjalmarsson
Bill Harpley wrote: [2009-01-23 09:20:48,719]TRACE [server-1] [http-80-5] a...@mydomain.net :090123-092048567:f5825 (SetCallForwardStatusImpl.java:call:54) - RequestId [81e80] SetCallForwardStatus.REQ { accountNumber:=W12345, phoneNumber:=12121212121, onBusyStatus:=true, busyCurrent:=voicemail,

Re: Simple regex problem has me baffled

2009-01-26 Thread John W. Krahn
Bill Harpley wrote: Hello, Hello, I have simple regex problem that is driving me crazy. I am writing a script to analyse a log file. It contains Java related information about requests and responses. Each pair of Request (REQ) and Response (RES) calls have a unique Request ID. This is a 5 d

Re: Simple regex problem has me baffled

2009-01-26 Thread Mr. Shawn H. Corey
On Mon, 2009-01-26 at 16:20 +0100, Bill Harpley wrote: > foreach $entry(@list) > { > > $entry =~ /\[([a-z0-9]{5})\]/; > > print "$1\n"; # print to screen > > # print FILE "$1\n";# print to file > } If there is no match, you are printing a uninitiali

Re: Simple RegEx expresion

2006-01-26 Thread Mazhar
Hi George, Are you looking for a TCL script or a PERL regex expression, if you are using PERL then try the code what Dmitry Motevich has written if u need in TCL then try the below --- set x "Linz_Untauglich Dr." set result [regexp (_)(

Re: Simple RegEx expresion

2006-01-25 Thread John Doe
George Homorozeanu am Mittwoch, 25. Januar 2006 16.12: > I need it with RegEx, that's my problem. > > Thanks, > > George. > > "Xavier Noria" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > news:[EMAIL PROTECTED] > > > On Jan 25, 2006, at 12:23, George Homorozeanu wrote: > >> I am very new in RegEx and

Re: Simple RegEx expresion

2006-01-25 Thread Dmitry
Hello George, Wednesday, January 25, 2006, 1:23:41 PM, you wrote: GH> Hi, GH> I am very new in RegEx and I want to be able to write an expresion that does GH> the following: GH> Return all the characters from a string starting from the 5-th character. GH> Given: GH> Linz_Untauglich Dr. GH>

Re: Simple RegEx expresion

2006-01-25 Thread George Homorozeanu
I need it with RegEx, that's my problem. Thanks, George. "Xavier Noria" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > On Jan 25, 2006, at 12:23, George Homorozeanu wrote: > >> I am very new in RegEx and I want to be able to write an expresion that >> does >> the followin

Re: Simple RegEx expresion

2006-01-25 Thread Randal L. Schwartz
> "George" == "George Homorozeanu" <[EMAIL PROTECTED]> writes: George> Hi, George> I am very new in RegEx and I want to be able to write an expresion that does George> the following: George> Return all the characters from a string starting from the 5-th character. Call me paranoid, but th

Re: Simple RegEx expresion

2006-01-25 Thread Xavier Noria
On Jan 25, 2006, at 12:23, George Homorozeanu wrote: I am very new in RegEx and I want to be able to write an expresion that does the following: Return all the characters from a string starting from the 5-th character. You want to do it with a regexp for some particular reason? That's t

Re: Simple regex

2004-04-16 Thread Rob Dixon
Rob Hanson wrote: > > Try this... > > # untested > $text =~ s/\[[^\]]+?\]/$1/g; > > [^\]] - means anything but a closing bracket > +? - means 1 or more times (as few as possible) Hi Rob You're not capturing $1, so you would be replacing them and their contents with 'undef'. (The opposite of what

Re: Simple regex

2004-04-15 Thread Randy W. Sims
On 4/15/2004 7:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = MTBL, welltype = OIL] use Text::Balanced; # includ

Re: Simple regex

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 6:22 PM, James Edward Gray II wrote: On Apr 15, 2004, at 6:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data

Re: Simple regex

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 6:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = MTBL, welltype = OIL] Maybe: s/^[^[]]*\[

Re: Simple regex

2004-04-15 Thread WilliamGunther
In a message dated 4/15/2004 7:13:09 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >How can I write a regular expression to keep the part of a string that's >between a pair of square braces? Here's a sample line: > >Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = >MT

RE: Simple regex

2004-04-15 Thread Hanson, Rob
Try this... # untested $text =~ s/\[[^\]]+?\]/$1/g; [^\]] - means anything but a closing bracket +? - means 1 or more times (as few as possible) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:11 PM To: [EMAIL PROTECTED] Subject:

Re: Simple Regex Problem.

2003-03-08 Thread Scott R. Godin
Rob Dixon wrote: >> you want to know what's failing, right? > > Wrong. John was just pointing out that $1 would remain > defined from a previous regex match in my previous post. > This would mean that there was no way of telling in > retrospect if the match had suceeded. The context of > the prob

Re: Simple Regex Problem.

2003-03-07 Thread Rob Dixon
Hi Scott. Scott R. Godin wrote: > Rob Dixon wrote: > > > Paul Johnson wrote: > > > Rob Dixon said: > > > > > > > $data =~ m/ <([^>]*)> /x; > > > > my $newdata = $1; > > > > > > And if the match fails? > > > > Well I think it's likely that you'd want to do: > > > > $data =~ m/ <([^>]*)>

Re: Simple Regex Problem.

2003-03-07 Thread Scott R. Godin
Rob Dixon wrote: > Paul Johnson wrote: >> Rob Dixon said: >> >> > $data =~ m/ <([^>]*)> /x; >> > my $newdata = $1; >> >> And if the match fails? > > Well I think it's likely that you'd want to do: > > $data =~ m/ <([^>]*)> /x or die "Malformed data"; > > or at least: > > $data

Re: Simple Regex Problem.

2003-03-07 Thread Scott R. Godin
David wrote: > Gregg R . Allen wrote: > >> It was close but what I got is : "JohnDoe.com" Instead of >> "[EMAIL PROTECTED]". >> >> I think it has something to do with escaping the "@" sign. I've been >> experimenting, but without much luck. >> > > that's because Perl thinks @Someplace is an

Re: Simple Regex Problem.

2003-03-05 Thread Rob Dixon
Paul Johnson wrote: > Rob Dixon said: > > > $data =~ m/ <([^>]*)> /x; > > my $newdata = $1; > > And if the match fails? Well I think it's likely that you'd want to do: $data =~ m/ <([^>]*)> /x or die "Malformed data"; or at least: $data =~ m/ <([^>]*)> /x or next; as a mismatch

Re: Simple Regex Problem.

2003-03-05 Thread Paul Johnson
Rob Dixon said: > $data =~ m/ <([^>]*)> /x; > my $newdata = $1; And if the match fails? -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Simple Regex Problem.

2003-03-05 Thread Rob Dixon
David --- Senior Programmer Analyst --- Wgo Wagner wrote: > I had to change as follows: > my $data = 'BlahBlahBlahBlah From: BlahsvilleDude > <[EMAIL PROTECTED]>BlahBBlahBBlah'; > > printf "bf:%-s\n", $data; > > $data =~ s/^.*<([^>]*)>.*$/$1/gs; > > printf "af:%-s\n", $data; > > but it does work t

Re: Simple Regex Problem.

2003-03-05 Thread Rob Dixon
Rob Hanson wrote: > Try this... > > my $data = "BlahBlahBlahBlah From: BlahsvilleDude > <[EMAIL PROTECTED]>BlahBBlahBBlah" > $data =~ s/^.*<([^>]*)>.*$/$1/; Hi Rob. Anchoring the search at the start of the string and then allowing 'any number of anything' is the same as not anchoring it! Likewis

RE: Simple Regex Problem.

2003-03-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Gregg R. Allen wrote: > It was close but what I got is : "JohnDoe.com" Instead of > "[EMAIL PROTECTED]". > > I think it has something to do with escaping the "@" sign. I've been > experimenting, but without much luck. > > Thanks, > > Gregg > > > On Tuesday, Mar 4, 2003, at 15:31 US/Mountain,

Re: Simple Regex Problem.

2003-03-04 Thread david
Gregg R . Allen wrote: > It was close but what I got is : "JohnDoe.com" Instead of > "[EMAIL PROTECTED]". > > I think it has something to do with escaping the "@" sign. I've been > experimenting, but without much luck. > that's because Perl thinks @Someplace is an array. if you have warning

RE: Simple Regex Problem.

2003-03-04 Thread Beau E. Cox
Hi - > -Original Message- > From: Gregg R. Allen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 04, 2003 2:16 PM > To: Hanson, Rob > Cc: Gregg R. Allen; [EMAIL PROTECTED] > Subject: Re: Simple Regex Problem. > > > It was close but what I got is : "Jo

Re: Simple Regex Problem.

2003-03-04 Thread Gregg R . Allen
It was close but what I got is : "JohnDoe.com" Instead of "[EMAIL PROTECTED]". I think it has something to do with escaping the "@" sign. I've been experimenting, but without much luck. Thanks, Gregg On Tuesday, Mar 4, 2003, at 15:31 US/Mountain, Hanson, Rob wrote: Try this... my $data =

RE: Simple Regex Problem.

2003-03-04 Thread Hanson, Rob
Try this... my $data = "BlahBlahBlahBlah From: BlahsvilleDude <[EMAIL PROTECTED]>BlahBBlahBBlah" $data =~ s/^.*<([^>]*)>.*$/$1/; Broken down... s/ = substitute ^ = beginning of string .* = anything, zero or more times < = "<" ( = start trapping text [^>]* = anything but ">", zero or more times )

Re: simple regex problem

2003-02-27 Thread Ramprasad
R. Joseph Newton wrote: Ramprasad wrote: hello all, I have a file read into a single string, and I want to write a regex that will tell me wether the file contains any non hashed line __DATA__ ## FORWARD ## FORWARD ## VACATION ## VACATION __END__ But my regex fails in case of any blank lines o

Re: simple regex problem

2003-02-27 Thread R. Joseph Newton
Ramprasad wrote: > hello all, > > I have a file read into a single string, and I want to write a regex > that will tell me wether the file contains any non hashed line > > __DATA__ > ## FORWARD > ## FORWARD > ## VACATION > ## VACATION > __END__ > > But my regex fails in case of any blank lines or

Re: simple regex problem

2003-02-27 Thread Ramprasad
Ramprasad wrote: hello all, I have a file read into a single string, and I want to write a regex that will tell me wether the file contains any non hashed line This is my test script #!/usr/bin/perl # { local($/)=undef; $str=; } print $str; if($str=~/^\s*[^#]/m){ print "NOT ENTIRELY COMMENT

Re: simple (???) regex help

2002-11-20 Thread Jeff 'japhy' Pinyan
On Nov 20, Marco Centemeri said: >How can I know if a variable is exactly 6 digit long? if ($str =~ /\A\d{6}\z/) { ... } The \A matches the beginning of the string, \d{6} matches 6 digits, and the \z matches the end of the string. If you meant "characters" instead of "digits", don't use a reg

RE: simple (???) regex help

2002-11-20 Thread wiggins
perldoc -f length http://danconia.org On Wed, 20 Nov 2002 16:03:35 +0100, Marco Centemeri <[EMAIL PROTECTED]> wrote: > Hi All!! > > How can I know if a variable is exactly 6 digit long? > > I tried: > >$myvar='ABCDEF'; >if ($myvar =~ /

Re: SIMPLE regex expression comparison !! - What am I doing wrong?

2002-10-16 Thread John W. Krahn
Lance Murray wrote: > > Hello Hello, > I'm trying to write a simple script to test if a port is up or down. It all > depends on being able to parse for the word "Connected" in an array. Try as > I might, I can't figure out why the following regex comparison won't work. Perhaps you need the

RE: SIMPLE regex expression comparison !! - What am I doing wrong?

2002-10-16 Thread Beau E. Cox
Hi - 1) try: if ($reply[1] =~ /Connected/) { ... I _think_ w/o parens, Perl says: if $reply[1] => true true =~ /Connected/ => false (you also may have to have the m in m/Connected/ 2) whole array: for (@reply) { if (/Connected/) { ... OK ... last; } } 3) after having read

Re: SIMPLE regex expression comparison !! - What am I doing wrong?

2002-10-16 Thread Jeff 'japhy' Pinyan
On Oct 16, Lance Murray said: >#!/bin/perl You should get used to using 'strict' and warnings #!/bin/perl -w use strict; >$host = @ARGV[0]; That should be $ARGV[0]. >$port = @ARGV[1]; Why not: my ($host, $port) = @ARGV; >@reply = `echo " " | telnet $host $port`; >if $reply[1] =~ /Co

RE: Simple RegEx Question

2002-09-11 Thread Timothy Johnson
11, 2002 8:26 AM To: Bob Showalter; [EMAIL PROTECTED] Subject: RE: Simple RegEx Question Thanks Nikola and Bob. Would "anchoring with \z" tantamount to having a trailing "$"? In other words, are the following expressions one and the same? /^[0-9a-fA-F]+\z/ /^[0-9a-fA-F]+$/ _

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
Thanks Nikola and Bob. Would "anchoring with \z" tantamount to having a trailing "$"? In other words, are the following expressions one and the same? /^[0-9a-fA-F]+\z/ /^[0-9a-fA-F]+$/ __ Yahoo! - We Remember 9-11: A tribute to the more than 3

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
ola Janceski; [EMAIL PROTECTED] Subject: RE: Simple RegEx Question use strict; while(){ chomp; if(/[^0-9a-fA-F]+/){ print("$_ is not a hexadecimal number!\n"); }else{ print("$_ is a hexadecimal number!\n"); } } __DATA__ f4dxf ffaa99 gxad 2832 2842da --- N

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
use strict; while(){ chomp; if(/[^0-9a-fA-F]+/){ print("$_ is not a hexadecimal number!\n"); }else{ print("$_ is a hexadecimal number!\n"); } } __DATA__ f4dxf ffaa99 gxad 2832 2842da --- Nikola Janceski <[EMAIL PROTECTED]> wrote: > give us a snippet of your code. you made a mist

RE: Simple RegEx Question

2002-09-11 Thread Bob Showalter
> -Original Message- > From: RTO RTO [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 11, 2002 11:00 AM > To: [EMAIL PROTECTED] > Subject: Simple RegEx Question > > > Here is a RegEx that I am using to check if the given > string is Hexadecimal or not. > > /[^0-9a-fA-F]+/ #if t

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
give us a snippet of your code. you made a mistake somewhere. and give us examples of what the variables contain. -Original Message- From: RTO RTO [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 11:09 AM To: Nikola Janceski; [EMAIL PROTECTED] Subject: RE: Simple RegEx

RE: Simple RegEx Question

2002-09-11 Thread RTO RTO
I am afraid, your suggestion is even breaking for already working ones! i.e., it says HEXADECIMAL NUMBER for an invalid string like "f4dx" and also says HEXADECIMAL NUMBER for invalid empty strings. The one I had posited,without the leading "^" and "$" matched for all the cases correctly, except

RE: Simple RegEx Question

2002-09-11 Thread Nikola Janceski
see below /^[^0-9a-fA-F]+$/ #if this evals to true string is NOT ## start of string ^ and end of string $ -Original Message- From: RTO RTO [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 11:00 AM To: [EMAIL PROTECTED] Subject: Simple RegEx Question Here is a RegEx tha

Re: Simple regex question

2002-03-30 Thread bob ackerman
Ah... i see. in scalar context, it returns false until left is true. then returns true until right is true. just what we want. very handy. thanks. On Saturday, March 30, 2002, at 11:48 AM, Jenda Krynicky wrote: > From: bob ackerman <[EMAIL PROTECTED]> >> sorry. still in dark. >

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
From: bob ackerman <[EMAIL PROTECTED]> > sorry. still in dark. > what exactly does '/START_KEYWORD/.../END_KEYWORD/' mean? > I see a regex -> /START_KEYWORD/ > an ellipsis -> ... > and a regex -> /END_KEYWORD/ > you are saying the whole thing means something, but I don't underst

Re: Simple regex question

2002-03-30 Thread bob ackerman
sorry. still in dark. what exactly does '/START_KEYWORD/.../END_KEYWORD/' mean? I see a regex -> /START_KEYWORD/ an ellipsis -> ... and a regex -> /END_KEYWORD/ you are saying the whole thing means something, but I don't understand what. you say 'the elipsis returns false' what does that mean? w

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
From: bob ackerman <[EMAIL PROTECTED]> > i don't understand your answer. how will that match anything? > the first line matches the whole block ok, but then the match is > dropped by the '!' phrases since they are in the text. also, where is > documented the ellipsis in a grep?

Re: Simple regex question

2002-03-30 Thread bob ackerman
i don't understand your answer. how will that match anything? the first line matches the whole block ok, but then the match is dropped by the '!' phrases since they are in the text. also, where is documented the ellipsis in a grep? also, using two regexes on either side of the ellipsis? On Satu

Re: Simple regex question

2002-03-30 Thread Jenda Krynicky
From: Rob Lee <[EMAIL PROTECTED]> > I'm parsing a file with multiple Fortran-like blocks that look like: > START_KEYWORD > line 1 > line 2 > END_KEYWORD > > I want only the contents of each block, not the keywords. > > grep { /START_KEYWORD/.../END_KEYWORD/ } > returns

Re: Re: Simple regex string replacement problem

2002-01-10 Thread webmaster
Yes, I am in fact changing the template file. Personally my first experience with CGI::FastTemplate has made me wish it were a bit more flexible, but I suppose it's certainly conceivable that the flexibility is there and I just haven't found it based on what I read in perldoc. -Ian -- Original

Re: Re: Simple regex string replacement problem

2002-01-10 Thread Jeff 'japhy' Pinyan
On Jan 10, [EMAIL PROTECTED] said: >>Personally, I find that odd -- moving from an array of 21 elements to 21 >>DIFFERENT scalars?! > >You're right, it is odd. But unless I've missed how to take a populated >array and create a usable hash from it to pass to CGI::FastTemplate, this >is what I bel

Re: Simple regex string replacement problem

2002-01-10 Thread webmaster
Jeff et al, >>I have a file which has many strings like "$something[0]" through >>"something[20]" amongst other text (quotes only provided here for >>clarity). >> >>What I want to do is replace these strings with: "$SOMETHING0" through >>"$SOMETHING20". > >Personally, I find that odd -- moving fr

Re: Simple regex string replacement problem

2002-01-10 Thread Jeff 'japhy' Pinyan
On Jan 10, [EMAIL PROTECTED] said: >I have a file which has many strings like "$something[0]" through >"something[20]" amongst other text (quotes only provided here for >clarity). > >What I want to do is replace these strings with: "$SOMETHING0" through >"$SOMETHING20". Personally, I find that o

RE: simple regex question

2001-06-28 Thread John Edwards
Sorry. Ignore that. It's 5:30 and home time. What can I say. Use this instead. $dnvalue =~ /CN=(\w*)/; $username = $1; print $username -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 28 June 2001 17:31 To: 'Mike Ring'; [EMAIL PROTECTED] Subject: R

RE: simple regex question

2001-06-28 Thread John Edwards
There's no need to match past the CN=, then prepend the CN= back to the string. Use the following $dnvalue = "CN=foo,OU=bar,O=pah"; $dnvalue =~ /(CN=[A-Za-z0-9]*)/; $username = $1; print $username This looks for CN= followed by any number of letters (upper or lowercase) and numbers. If you don'

Re: simple regex question

2001-06-28 Thread Paul
--- Mike Ring <[EMAIL PROTECTED]> wrote: > I've learned a bit about regular expressions today. I have a string > formatted > like "CN=foo,OU=bar,O=pah" and I need to parse out "foo". I have > created the > following code which does work: > > $dnvalue =~ m/([^,]*)/; > $username = $1; > $username