Re: Help me with a regex problem

2019-10-26 Thread Dermot
You might consider using Regexp::Common::net. It provides a convenient set of functions for matching IP v4, v6 and mac addresses. https://metacpan.org/pod/Regexp::Common::net On Fri, 25 Oct 2019 at 19:43, John W. Krahn wrote: > On 2019-10-25 3:23 a.m., Maggie Q Roth wrote: > > Hello > > Hell

Re: Help me with a regex problem

2019-10-25 Thread John W. Krahn
On 2019-10-25 3:23 a.m., Maggie Q Roth wrote: Hello Hello. There are two primary types of lines in the log: What are those two types? How do you define them? 60.191.38.xx/ 42.120.161.xx /archives/1005 From my point of view those two lines have two fields, the first loo

Re: Help me with a regex problem

2019-10-25 Thread Andy Bach
/(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ To avoid the "leaning toothpick" problem, Perl lets use different match delimiters, so the above is the same as: m#(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?/.*)# I assume you want to capture the IP and the path, right? if

Re: Help me with a regex problem

2019-10-25 Thread Benjamin S Pendygraft II
That is a backslash followed by a forward slash. The backslash tells the regex parser to treat the next character as a literal character. Useful for matching periods, question marks, brackets, etc. A period matches any character once and an asterisk matches the previous character any number of time

Re: Help me with a regex problem

2019-10-25 Thread X Dungeness
my $n = '[0-9]{1,3}'; if ( =~ ( m[ (?:$n\.){3} $n \s+ \S+ ]x ) { # match } On Fri, Oct 25, 2019 at 3:37 AM Maggie Q Roth wrote: > what's V.*? > > Maggie > > On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote: > >> For example, this regex >> >> /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,

Re: Help me with a regex problem

2019-10-25 Thread Maggie Q Roth
what's V.*? Maggie On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote: > For example, this regex > > /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ > > On 25.10.2019 13:23, Maggie Q Roth wrote: > > Hello > > > > There are two primary types of lines in the log: > > > > 60.191.38.

Re: Help me with a regex problem

2019-10-25 Thread Илья Рассадин
For example, this regex /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/ On 25.10.2019 13:23, Maggie Q Roth wrote: Hello There are two primary types of lines in the log: 60.191.38.xx        / 42.120.161.xx       /archives/1005 I know how to write regex to match each line, but do

Help me with a regex problem

2019-10-25 Thread Maggie Q Roth
Hello There are two primary types of lines in the log: 60.191.38.xx/ 42.120.161.xx /archives/1005 I know how to write regex to match each line, but don't get the good result with one regex to match both lines. Can you help? Thanks, Maggie

Re: A regex problem?

2012-08-13 Thread Andy Bach
On Mon, Aug 13, 2012 at 5:42 AM, Owen wrote: > I have a web form with a text area that I feed back through a cgi > script and "filter" the text with; > > $q1_elaborate =~ s/[^[:alpha:]' .-]//g; > quotemeta($q1_elaborate); > > However, it removes line feeds as well, so maybe that code is not al

A regex problem?

2012-08-13 Thread Owen
I have a web form with a text area that I feed back through a cgi script and "filter" the text with; $q1_elaborate =~ s/[^[:alpha:]' .-]//g; quotemeta($q1_elaborate); I admit to doing a google search on "perl remove malicious code" and took that code from one of the results.(and not quite und

Re: A regex problem.

2004-11-09 Thread William C. Bruce
[EMAIL PROTECTED] (Denham Eva) wrote in news:[EMAIL PROTECTED]: > Hello Gurus, > In a script I have a piece of code as such:- > * snip** > my $filedate =~ s/(\d+)//g; > * snip end *** > The data I am parsing looks as such :- > ** DATA >

Re: A regex problem.

2004-09-06 Thread Ing. Branislav Gerzo
Denham Eva [DE], on Monday, September 6, 2004 at 14:41 (+0200) typed: DE> my $filedate =~ s/(\d+)//g; DE> ** DATA DE> C:/directory/MSISExport_20040814.csv DE> C:/directory/MSISExport_20040813.csv DE> Can someone help me with that regex? I am having a frustrating time of I hop

Re: A regex problem.

2004-09-06 Thread Gunnar Hjalmarsson
Jaffer Shaik wrote: Try in this way. Just remove "my", you will get it. What kind of stupid advice is that? $filedate = "C:/directory/MSISExport_20040814.csv"; ($filedate) =~ s/(\_\d+)//g; Left aside that the parentheses are redundant, that does the opposite of what the OP asked for. -- Gunnar Hj

Re: A regex problem.

2004-09-06 Thread Flemming Greve Skovengaard
Denham Eva wrote: Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; Try this instead: my $filedate; if( $var_with_file_name =~ m/(\d+)\.csv$/ ) { $filedate = $1; } print "$filename\n"; * snip end **

RE: A regex problem.

2004-09-06 Thread Jaffer Shaik
September 06, 2004 6:11 PM To: [EMAIL PROTECTED] Subject: A regex problem. Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; * snip end *** The data I am parsing looks as such :- ** D

A regex problem.

2004-09-06 Thread Denham Eva
Hello Gurus, In a script I have a piece of code as such:- * snip** my $filedate =~ s/(\d+)//g; * snip end *** The data I am parsing looks as such :- ** DATA C:/directory/MSISExport_20040814.csv C:/directory/MSISE

Re: Having a Regex Problem...

2002-06-05 Thread David T-G
Michael -- ...and then Michael Norris said... % % This subroutine is supposed to chech the validity of an IP address. 4 numbers (1 - 255) separated by ".". But my regular expression doesn't seem to be working out for me. % ... % if ($_[0] =~ m/([1-2][0..5]*[0..5]*)\.\1\.\1\.\\s*$/) { I do

Re: Having a Regex Problem...

2002-06-05 Thread Jeff 'japhy' Pinyan
On Jun 5, Michael Norris said: >This subroutine is supposed to chech the validity of an IP address. 4 >numbers (1 - 255) separated by ".". But my regular expression doesn't >seem to be working out for me. > if ($_[0] =~ m/([1-2][0..5]*[0..5]*)\.\1\.\1\.\\s*$/) { [0..5] means [05.] -- that is,

Having a Regex Problem...

2002-06-05 Thread Michael Norris
This subroutine is supposed to chech the validity of an IP address. 4 numbers (1 - 255) separated by ".". But my regular expression doesn't seem to be working out for me. print "Enter IP address: "; chomp($ip = ); &ipcheck($ip); sub ipcheck{ if ($_[0] =~ m/([1-2][0..5]*[0..5]*)\.\1\.\1\.\\s