Regex question

2005-08-26 Thread Sandeep Deshpande
Dear All, I am trying to pass list of acceptable characters in a string and then warn user about un-acceptable characters in the said string. My sample script goes as follows CASE 1:- my $filebuf = ABCD123{}\[\]`; if ($filebuf =~

Re: Regex question

2005-08-26 Thread $Bill Luebkert
Sandeep Deshpande wrote: Dear All, I am trying to pass list of acceptable characters in a string and then warn user about un-acceptable characters in the said string. My sample script goes as follows CASE 1:- my $filebuf =

Re: regex question

2004-10-28 Thread Paul Appleby
John, Both symbols are metacharacters when used in a regexp and must be escaped. Try: $del=\^; Or better, try not using a scalar variable. Just use the delimiter: @fields = split /\^/,$record; Paul I use a variable for a field delimiter when reading CSV files... I have been wrestling with the best

RE: regex question

2004-10-28 Thread Brian Raven
John V. Pataki wrote: I use a variable for a field delimiter when reading CSV files... I have been wrestling with the best way to code my split regex so that it works with all possible values of that variable. It is currently failing when I set the value of the variable to ^ # if

regex question

2004-10-27 Thread John V. Pataki
I use a variable for a field delimiter when reading CSV files... I have been wrestling with the best way to code my split regex so that it works with all possible values of that variable. It is currently failing when I set the value of the variable to ^ # if delimiter is | - this syntax

Re: regex question

2004-10-27 Thread David Craig
John, how about: (@fields) = split /(\||\^)/,$record; I know it looks like line noise, that's a pipe (escaped) a pipe (as the logical OR) and a caret (escaped) Pipe and caret have special meanings in regex, so they have to be handled specially. John V. Pataki wrote: I use a variable for a

Re: regex question

2004-10-27 Thread Williamawalters
john -- try $del = quotemeta $del; before the split statement. quotemeta escapes all non-word (\W) characters. also, ^ is a metacharacter in a regex character set [], but | is not. bill ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe:

Re: regex question

2004-10-27 Thread John V. Pataki
Dave and William, Dave,yes - but the idea is that this is a variable that I actually have set in a config file... I need a solution that allows for any delimiter put there -- it may need to change depending on the solution parameters... Anyway -- William's suggestions for both quotemeta and

Re: regex question

2004-09-22 Thread Andy_Bach
First off the '/sg' switches aren't needed. 's' is 'single' mode (so saith Freidl/Owl), changing the behaviour of '.' to allow it to match newlines - that's it! 'g' means repeat for every instance in the match. The first part, allowing parens to work in a pattern string wasn't so bad, but I

Re: regex question

2004-09-22 Thread $Bill Luebkert
[EMAIL PROTECTED] wrote: First off the '/sg' switches aren't needed. 's' is 'single' mode (so saith Freidl/Owl), changing the behaviour of '.' to allow it to match newlines - that's it! 'g' means repeat for every instance in the match. The first part, allowing parens to work in a pattern

Re: regex question

2004-09-22 Thread Eric Amick
On Wed, 22 Sep 2004 12:05:08 -0700, you wrote: If I do the following $Search = some text (some text) some text ; $Replace = New Text $1 New Text ; $Text =~ s/$Search/$Replace/sg ; what is the trick to getting the $1 to be resolved? The best I can manage is eval \$Text

Re: regex question

2004-09-14 Thread Williamawalters
In a message dated 9/14/2004 2:47:42 PM Eastern Standard Time, [EMAIL PROTECTED] writes: Hi List, I have a script as below #!/usr/bin/perl my $out = 'Using TDS 5.0 Processing select * from PowerSeller_prod.powerseller.loan_shipped from SYB_NJ14 to SYB_NJ14_WS Batch of 1/1 rows

RE: regex question

2004-09-14 Thread Thomas Wetmore
You are using the split function incorrectly... See perldoc -f split and try something like this: if($out =~ /Rows processed/ ) { my (undef, $rc) = split /:\s*/, $out; print $rc rows were copied\n; } Thomas if ( $out =~ /Rows processed/ ) { my ($rc)=split($out,/:/); print

RE: regex question

2004-03-12 Thread Brian Raven
Wagner, David --- Senior Programmer Analyst --- WGO wrote: [EMAIL PROTECTED] wrote: I am trying to do write a search comparison between to part numbers $found = 1 if $string1 =~ /$string2/g; If there can be reqex operators within the variable then you need to tell regex to

regex question

2004-03-10 Thread John V. Pataki
I am trying to do write a search comparison between to part numbers $found = 1 if $string1 =~ /$string2/g; I want to know if $string2 occurs within $string1. Basic enough ... however, I am finding that at times $string2 contains characters such as: ** and (+ABC etc. and this is giving

RE: regex question

2004-03-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: I am trying to do write a search comparison between to part numbers $found = 1 if $string1 =~ /$string2/g; If there can be reqex operators within the variable then you need to tell regex to not expand, so you would do something like: $found = 1

RE: Regex question

2003-03-26 Thread King, Jason G
francois writes.. There's a more funny way to do it. $result=(int($string*100))/100; Oh, it's funny you want: $result=substr($string,0,index($string,'.')+3); And also with rounding: $result=substr($string,0,index($string,'.')+3) +(substr($string,index($string,'.')+3,1)4?.01:0);

RE: Regex question

2003-01-29 Thread Olivier . Gerault
You can do something like : $out =~ m/(^.*Name\:.*$)/xo $name = $1; or if ($out =~ m/Name\:/xo) { $name = $out; } --- Legendo metulas imitabere cancrum Olivier GĂ©rault ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe:

Re: Regex question

2003-01-29 Thread Andy_Bach
You don't need the 'x' option (white space used in RE for comments) or the 'o' option (compile it - this is used when there is a variable in the RE, e.g. $name = Name: while () { if ( /$name/o ) { the colon (:) is not a special char and does not need an escape slash. The '1' you get now is

RE: Regex question

2003-01-29 Thread Arms, Mike
To: [EMAIL PROTECTED] Subject: Regex question List, I need your help with the regex in my script. $out = `c:/tmp/test.cmd /i $c`; The above line gets the result in the variable and I'm trying to match a pattern as below and I want to store the lines in another variable

Re: RE: regex question

2002-12-11 Thread Dmitry Kostyuk
I'm glad you have! I sure have as well. Not having seen any more breakage reports in the last couple of days, I assume the code's pretty good now. This means I can start working on the parsing part that has a few flaws as Jason points out. I am probably going to leave all properties content

RE: regex question

2002-12-09 Thread Dmitry Kostyuk
] Subject: RE: regex question Dmitry writes.. That was an interesting one, very well spotted, thanks. It only took a couple of minutes to figure out though. It was just a matter of adding $ to the unless loops. Anyway, here is the fixed version. That's got it. I can't think of any other

RE: regex question

2002-12-09 Thread Jenda Krynicky
From: Dmitry Kostyuk [EMAIL PROTECTED] Date sent: Mon, 09 Dec 2002 02:24:45 +0100 --- #!/usr/bin/perl #bodytag_v2.3.pl #regex that matches the body tag ... html head body

RE: regex question

2002-12-08 Thread King, Jason G
Dmitry writes.. Thanks for your feedback. This one took a little brain work. I had no time to work on this code yesterday, hence the delay. Anyway, here goes the brand new version: Fails on this: body onLoad=foo='bar' background='image.jpg' -- Jason King

RE: regex question

2002-12-08 Thread Dmitry Kostyuk
Fails on this: body onLoad=foo='bar' background='image.jpg' -- Jason King That was an interesting one, very well spotted, thanks. It only took a couple of minutes to figure out though. It was just a matter of adding $ to the unless loops. Anyway, here is the fixed version.

RE: regex question

2002-12-08 Thread King, Jason G
Dmitry writes.. That was an interesting one, very well spotted, thanks. It only took a couple of minutes to figure out though. It was just a matter of adding $ to the unless loops. Anyway, here is the fixed version. That's got it. I can't think of any other issues, except trivial things like

RE: regex question

2002-12-05 Thread Dmitry Kostyuk
-- Jason wrote : -- I'd be interested to see if you could generalise it across more than just the body tag - maybe storing tags in anonymous arrays in a hash that uses the tag name as the key - something like that. -- Yes, that's what I have in mind. The code is probably

RE: regex question

2002-12-05 Thread Jenda Krynicky
From: Dmitry Kostyuk [EMAIL PROTECTED] Anyway, here goes the new version: --- #!/usr/bin/perl #bodytag_v2.2.pl #regex that matches the body tag ... A few breakages ... body onLoad=foo='bar body onLoad= code = 'if (x d) {alert( 'Don\'t do that')

RE: regex question

2002-12-02 Thread Power, Jim \(CRTEU\)
Title: RE: regex question From a beginner's point of view I would recommend the module approch, having just used the html::parser to get rid of the nasty tags and then used file a regex to do the rest. Then again I'm only a newcommer to Perl and I only worry about getting the job done, maybe

Re: regex question

2002-12-02 Thread Dmitry Kostyuk
OK, all, this is a collective response to your comments. Thanks to all for your feedback. ** * Jason King * ** I don't think it's wise to assume anything about the input. In any case, if you want a more mundane example that also breaks your regex: body RESPONSE :

RE: regex question

2002-12-02 Thread King, Jason G
Dmitry writes.. ** * Jason King * ** I don't think it's wise to assume anything about the input. In any case, if you want a more mundane example that also breaks your regex: body RESPONSE : Jason, the original task was to match new line characters in the BODY tag.

RE: regex question

2002-12-02 Thread Basil Daoust
My problem with MODULES is you must also install them everywhere, if you use one that is outside the default installation. Of course the PASRE is not in the category with Activeperl. One also must take the time to understand HOW the module works. I quickly scanned PARSE when I went to use it and

RE: regex question

2002-12-02 Thread Dmitry Kostyuk
Jason King writes: What you said was Don't listen to those who are telling you to use modules, when you can use built-in regexes or other functions. You might now reflect and wish you'd started with a softer and more reasonable position, but you didn't - you came out against modules. RESPONSE:

RE: regex question

2002-12-02 Thread Wayne Simmons
I've got an idea how about both of you STFU and stop filling my mailbox with your flames. If you want to flame each other take it to private e-mail I don't think the whole list needs to be included in your boring stupid back and forth quibbling... I can't believe that two seemingly

Re: regex question

2002-12-02 Thread Mark Mielke
On Mon, Dec 02, 2002 at 11:34:41PM +0100, Dmitry Kostyuk wrote: [ Written to somebody else: ] I also said a normal regex is a pefectly viable solution here and I stand by that. I still have to see one example of a body tag where my code doesn't work. Your little piece of code that wasn't going

RE: regex question

2002-12-02 Thread King, Jason G
Basil writes.. My problem with MODULES is you must also install them everywhere, if you use one that is outside the default installation. Of course the PASRE is not in the category with Activeperl. Two comments: 1/ You have to ship the code that does the task anyway, it's either in your own

Re: regex question

2002-12-02 Thread Paul Barker
My problem with MODULES is you must also install them everywhere, if you use one that is outside the default installation. Of course the PASRE is not in the category with Activeperl. I agree with you on the problem of having to distribute modules with your code. I guess you could use perl2exe

RE: regex question

2002-12-02 Thread Mohammed Khatib
agree with everything you've said about this matter. Mk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Basil Daoust Sent: Tuesday, 3 December 2002 9:20 AM To: King, Jason G Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: regex question My

Re: regex question

2002-12-01 Thread Mark Mielke
On Mon, Dec 02, 2002 at 09:27:28AM +1000, King, Jason G wrote: Alternatively, just use HTML::Parser or HTML::TokeParser and you can handle arbitrarily complex body tags without having to worry about what your input is. I second this suggestion. It is highly doubtful that a single REGEXP that

Re: regex question

2002-12-01 Thread $Bill Luebkert
Mark Mielke wrote: On Mon, Dec 02, 2002 at 09:27:28AM +1000, King, Jason G wrote: Alternatively, just use HTML::Parser or HTML::TokeParser and you can handle arbitrarily complex body tags without having to worry about what your input is. I second this suggestion. It is highly doubtful that a

a regex question

2001-05-24 Thread Bill Stennett
Hi All I'm trying to create a regex to allow me to extract a value from a string composed of name=value pairs seperated by the '' symbol. The problem I have is that there is no guarantee in which order the name=value pairs will appear - the significance of this being that

RE: a regex question

2001-05-24 Thread Arthur Cohen
string for a CGI app, you might just want to use the CGI module (or even cgi-lib.pl) instead. HTH, --Art -Original Message- From: Bill Stennett [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 4:10 PM To: [EMAIL PROTECTED] Subject: a regex question Hi

Re: a regex question

2001-05-24 Thread Bill Stennett
this snippet does not match and print the value 123. Bill Stennett - Original Message - From: Arthur Cohen [EMAIL PROTECTED] To: Bill Stennett [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, May 24, 2001 9:31 PM Subject: RE: a regex question Hi Bill; If you put a ? after

Re: a regex question

2001-05-24 Thread Bill Mosley
At 09:10 PM 05/24/01 +0100, Bill Stennett wrote: Hi All I'm trying to create a regex to allow me to extract a value from a string composed of name=value pairs seperated by the '' symbol. The problem I have is that there is no guarantee in which order the name=value pairs will appear - the

RegEx question: This works, but not as I expected

2000-11-21 Thread Scott Johnson
I was trying to format a list of library hours at a university library to later enter into my Visor so I started to write a Perl script to do so. An example of the text I was trying to modify is below: UNDERGRADUATE(UG) Undergraduate Library Bldg., 333-1031; M

RE: Simple regex question

2000-11-14 Thread william . meitzen
Title: RE: Simple regex question $event = "Yet another @ test string \$.?!" ; $event =~ s/[^A-Z!\.,'"?()\s]//ig; Produces: event: Yet another test string .?! -Original Message-From: Ebel, Horst [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 09, 2000 7:4