Javascript Regex to Perl Regex

2006-03-23 Thread Kevin Old
Hello everyone, I have a piece of javascript that formats a chunk of javascript into a "pretty print" version of it. I'd like to have a command line version of this, but can't seem to get the regexes to work in Perl. Just a long shot, but can anyone help with the conversion of them from JS to Pe

Regex

2011-01-26 Thread Greg J
I am trying to extract numeric values from a data file and I'm having trouble writing a regular expression that would do this. My data looks like this: <{5, 26}{20, 42, 64}{23, 48}> I am trying to turn this into a list of lists [ [5, 26], [20, 42, 64], [23,48] ] Any pointers would be greatly app

regex

2011-11-04 Thread Chris Stinemetz
I am trying to match a line that has HEH in it. I would also like to store the number follow CELL in memory variable $1 and store everything following the number and upto excluding ", HEH" in memory variable $2 so this line: Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH will equal: $1 = 999 $2 = CDM 1,

regex

2012-04-08 Thread Somu
Hello everyone... Thanks for the previous replies. I'm really improving! A new problem.. Check if the word begins with un or in and has exactly 5 letters. $word =~ '^(un|in).{3}$' Check if the word begins with un or in or non and has more than 5 letters. $word =~ '^(un|in).{3}.+$' What do i do

regex

2024-01-22 Thread Jorge Almeida
Please help me to understand this: $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' $ echo $? $ 10 Thanks Jorge Almeida

Regex

2005-11-07 Thread Ward.P.Fontenot
I have a field that looks like this: 'modprobe: modprobe: Can't locate module char-major-10-134' I need to add a single quote so that it looks like this: 'modprobe: modprobe: Can''t locate module char-major-10-134' But I have no idea how to go about doing that, can I get an example? Thanks s

regex

2005-11-16 Thread Gerard Robin
Hello, in a script I can write: if ( $subject =~ /phar/i or $subject =~ /phfar/i or $subject =~ /phhar/i or $subject =~ /phya/i or $subject =~ /photo/i ){..} "or" if ( $subject =~ /ph(ar|far|har|ya|oto)/i ){...} "or" if ( $subject =~ qr(ph(ar|far|har|ya|oto))i )

regex...

2006-01-09 Thread Tom Allison
this: $string =~ m|(?:href|src)\W+(?:http://)?([^/]*)(/[^'"]*)(?:['"])|gsm But it's not working very well. I get this error Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE ?:href/ at http_filter.t line 14. I also tried: m|(?:(src|href)) with similar results. I'm not

Regex

2002-12-06 Thread Steve Main
Hello list, I am trying to code a regex to pull out the number part of "ORA-600" or 600. I have started with "if ($line =~ m/^(ORA-)(\-[0-9]*)$/) {" but this is obviously wrong. Anyone out there willing to get me on the right track? thanks Steve -- To unsubsc

regex

2002-12-16 Thread tallison
What is the difference between: $arg = "foo \(bar\)"; and $arg = 'foo \(bar\)'; when using like: s/$arg/bleah/; One works, one doesn't. Why? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Regex..

2004-02-10 Thread Singh, Ajit p
Could some good samaritan help me out with this pls... I am trying to find a regular expression for the below string.. ExchangeName = MOLD%20WEST ExpectedDate = LineStatus = Z Status = NO 200 OK - and i am trying with something as below: $line =~ /([a-zA-Z_0-9.]+)\s*=\s*([a-zA-Z_0-9.]+)

Regex(?)

2003-07-26 Thread Franklin, Douglass
I'm trying to transform this html table to a colon-delimited flat-file database. This is what I have so far: HTML: ACCOUNTANT $24,701.00 - $51,971.00 INDEFINITE CONTINENTAL U.S., US   Database Record (wanted): Accountant:$24,701.00 - $51,971.00:INDEFINITE:CONTINENTAL U.S., US Regex I

regex

2001-06-20 Thread Yacketta, Ronald
Folks, I have been looking for a little regex that would remove NULL (blank) lines from input. I have a little script that parses the output of timex (unix), unfortuanly the timex output is prepended with a blank line and appended with a blank line as such (timex ps -ef > /dev/nul) 2

regex

2001-10-04 Thread Florentin Ionescu
I am trying to extract "xvar" from a string like $a="la la la set /Y xvar= yval".- the switch /y can exist or not. $a=~s#.*[Ss][Ee][Tt]\s+(\/\w?)\s+(\w+)=.*#$1#; Why doesn't this get "xvar" from $a ? Thank you for participation, Florentin. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Regex!

2002-04-09 Thread Daniel Falkenberg
Hello All, Just wondering how I can remove unwanted characters from a simple variable. $money = "\$21.85"; Now I simply want to strip the $ sign from that variable. Easy? Well I thought it would be :) $money = s/$//; # Well thats what I thought! Regards, Dan -- To unsubscribe, e-mail:

regex

2002-04-28 Thread Mat Harrison
what sort of regex's should i be looking at to validate a username and password field so that input can only be up to and including 15 chars long and does not contain any special characters? -- Matthew Harrison Webmaster www.genestate.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PRO

regex

2002-06-07 Thread Eduardo Cancino
Hi. I'm parsing a text file with this estrcuture line: 'here is a quote'. Autor (birth year - death year); occupation nationality. == I need to separate from the beggining to the first dot, ignoring the dots in side the two ''. but i have tried to escape the ' (\'), but no use, what i'm m

Regex

2007-11-13 Thread neelike
length-3 rule //only one space rule (i.e) NOV 1GR my regex is ^[a-z]{2,4}\s(\d\w+){3})!gi; Can u correct my error.thanks... Regards, Boniface... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Regex "([^"]*)

2001-05-06 Thread Clinton
Hi I'm tring to extract some values delimited by quotes I can extract the first set using "([^"]*) but not the second set using "([^"]*),"([^"]*). Could I have a clue please? Regards CJ CODE use strict; my $file = "test.txt"; #extract from file my $stuff="e:/$file"; open STUFF, $stuff or die "Ca

regex

2002-01-03 Thread Lawrence Liew
Hi, I would like to match the following text (of different lines but standrad text) using regex. How can I do that? Status of this document This document is from an electronic database of legislation maintained by the Parliamentary Counsel’s Office of Western Australia. Disclaimer (a)no

Regex...

2002-02-27 Thread Daniel Falkenberg
Hey all, I am just working on a small text file and was wondering if a regular expression would help me here. Basically the text file looks like this... User data query User data query Time utilization for this billing period Pre-paid hours: 744 Hours used so far: 29.55 Excess hours billed

RE: Javascript Regex to Perl Regex

2006-03-23 Thread Timothy Johnson
Sent: Thursday, March 23, 2006 11:17 AM To: Perl Beginners Subject: Javascript Regex to Perl Regex Hello everyone, I have a piece of javascript that formats a chunk of javascript into a "pretty print" version of it. I'd like to have a command line version of this, but can't s

Re: Javascript Regex to Perl Regex

2006-03-23 Thread Kevin Old
t; $fcode =~ s/^\s*function\s+(?:\w+\(\)\s*)?\s*\{\s*\n//gi; > > but I don't have any code to test it on. What do you expect to happen, > and what is really happening? > > -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED] > Sent: Thursd

RE: Javascript Regex to Perl Regex

2006-03-23 Thread Timothy Johnson
Using YAPE::Regex::Explain, this is how the first regex is being interpreted: The regular expression: (?-imsx:s/^\s*function\s+(?:\w+\(\)\s*)?\s*\{\s*\n//gi) matches as follows: NODE EXPLANATION -- (?-imsx

Re: Javascript Regex to Perl Regex

2006-03-23 Thread Jay Savage
On 3/23/06, Kevin Old <[EMAIL PROTECTED]> wrote: > Here's what I have. > > # Open js file > open JSFILE, "$ARGV[0]" or die "can't open file: $ARGV[0]"; > my $js = do { local( $/ ); }; > close JSFILE; > > # Clean js > $js =~ s/^\s*function\s+(?:\w+\(\)\s*)?\s*\{\s*\n//gi; > $js =~ s/\s*}\s*$//g

Regex problem

2009-03-10 Thread howa
Hello, Consider the code: #=== use strict; my $a = 'a.jpg'; if ($a =~ /(html|jpg)/gi) { print 'ok'; } #=== Is the brucket "()" must be needed? Since I am not using back reference, are there a better way? Thanks. -- To unsubscribe, e-mail: beginners-uns

regex question

2009-09-15 Thread Gregory Machin
Hi I'm look for code example that will only select a string containing 3 digits .. The string cant be less than 3 digit , can't be more than 3 and can't contain any other characters. I have googled and found code that will find 3 consecutive digits within a string or at the beginning. Any ideas

regex question

2009-11-09 Thread axr0284
not know what it is in advance. 1)I would need perl to be able to distinguish between a relative and absolute path 2) If the path is relative, create an absolute path from that. My orignal idea was to locate ..\ with regex using m/([.]{2}\\)/ This would indicate if the path is relative or not

Regex problem

2009-12-21 Thread jbl
I have a lengthy list of data that I read in. I have substituted a one line example using __DATA__. The desired output would be 91416722243rd St I am getting this as output 91416722rd St <- just the rd St The capturing reference on (\s)..$1 is not working # Intent # Look for

regex question

2009-12-21 Thread Jim Green
Hi, I have a text file with lines like this · Experience in C/C++ realtime system programming · Experience in ACE, FIX Could anybody tell me which regex to use to get rid of the dot and the leading spaces before each Line? Thanks for any help! Jim -- To unsubscribe, e

regex question

2009-12-22 Thread Jim Green
Hi, I have a text file with lines like this · Experience in C/C++ realtime system programming · Experience in ACE, FIX Could anybody tell me which regex to use to get rid of the dot and the leading spaces before each Line? Thanks for any help! Jim -- To unsubscribe, e

Regex problem

2009-12-26 Thread Owen
To check the date passed with a script, I first check that the date is in the format 20dd (20 followed by 6 digits exactly) But the regex is wrong, tried /^20\d{6}/,/^20\d{6,6}?/,/^20\d{6,}?/ and while a 7 or lesser digit number fails, eg 2009101, a 9 digit number, like 200910103 does not

regex optimization

2010-01-04 Thread Jeff Peng
Hello, Can the code (specially the regex) below be optimized to run faster? #!/usr/bin/perl for ($i=0; $i<1000; $i+=1) { open HD,"index.html" or die $!; while() { print $1,"\n" if /href="http:\/\/(.*?)\/.*" target="_blank"/; } close HD; } Th

Regex question

2010-03-24 Thread Bruce Ferrell
if ( ! defined $username || ! $username =~ /[0-9]{10,11}/ ) { do something; } else { do something else; } what that's supposed to do is this: if it's blank or not 10 or 11 digits... The question is where is my understanding faulty or did I mess up. Thanks in advance Bruce -- To unsubscri

regex question

2010-07-02 Thread sdDirtySox
Hi all, I want to use a perl script that will look at all the files in a directory to find an instance of a function and replace it with another. I have the code in place to look at all the files in a directory and to search line by line, but I'm having problems with the regex to use. Ex

regex problem

2010-11-05 Thread jm
more data,"possibly more embedded ,'s",and,so,on,,, changing the formatting of the source file to enclose all fields in double quotes is not an option. i'm trying to figure out a regex, split, or some other functionality that will allow me to either 1. wrap each 'bare&#x

Re: Regex

2011-01-26 Thread Ramesh Kumar
rint Dumper $list_of_list; # or the step by step method for my $outerlist (@$list_of_list) { for my $innerlist (@$outerlist) { print $innerlist . " "; } print "\n"; } From: Greg J To: beginners@perl.org Sent: Thu

Re: Regex

2011-01-26 Thread Jim Gibson
At 8:15 PM -0600 1/26/11, Greg J wrote: I am trying to extract numeric values from a data file and I'm having trouble writing a regular expression that would do this. My data looks like this: <{5, 26}{20, 42, 64}{23, 48}> I am trying to turn this into a list of lists [ [5, 26], [20, 42, 64], [2

Re: Regex

2011-01-26 Thread Rob Dixon
On 27/01/2011 02:15, Greg J wrote: I am trying to extract numeric values from a data file and I'm having trouble writing a regular expression that would do this. My data looks like this:<{5, 26}{20, 42, 64}{23, 48}> I am trying to turn this into a list of lists [ [5, 26], [20, 42, 64], [23,48]

Re: Regex

2011-01-26 Thread Ramesh Kumar
From: Rob Dixon To: beginners@perl.org Cc: Greg J Sent: Thu, January 27, 2011 11:38:07 AM Subject: Re: Regex On 27/01/2011 02:15, Greg J wrote: > I am trying to extract numeric values from a data file and I'm having > trouble writing a regular expression that would do this. &

Re: Regex

2011-01-27 Thread Rob Dixon
On 27/01/2011 06:23, Ramesh Kumar wrote: Hi Rob, I refer to your 2 lines of code: my $data = '<{5, 26}{20, 42, 64}{23, 48}>'; my $list = [ map { [ $_ =~ /\d+/g ] } $data =~ /(\{.*?\})/g ]; That's the type of Perl coding style I'm still trying to learn. Concise and elegant. Beautiful!!!

Re: Regex

2011-01-27 Thread Dr.Ruud
On 2011-01-27 03:56, Ramesh Kumar wrote: my $list_of_list = eval $data; # we get an anonymous list of list Looks like you didn't get the memo yet. :) String eval is normally not what you want. I only use it in exceptional cases. At least first check the contents of $data. That normally lea

Re: Regex

2011-01-28 Thread Mike McClain
On Thu, Jan 27, 2011 at 07:59:41PM +, Rob Dixon wrote: > On 27/01/2011 06:23, Ramesh Kumar wrote: > > > >Hi Rob, > > > >I refer to your 2 lines of code: > > > > my $data = '<{5, 26}{20, 42, 64}{23, 48}>'; > > my $list = [ map { [ $_ =~ /\d+/g ] } $data =~ /(\{.*?\})/g ]; > > > >That's the t

REGEX Explanation

2011-04-08 Thread Anirban Adhikary
Hi list Can anybody please explaing the meaning of the following regular expression my $x = '12abc34bf5'; @num = split /(a|b)+/, $x; print "NUM=@num\n"; NUM=12 b c34 b f5 Does it mean split the string ,here separaters are 'a' or 'b'(one or more occurance because of + metacharacter). If it matc

Regex help

2011-05-16 Thread Owen
I am trying to get all the 6 letter names in the second field in DATA below, eg BARTON DARWIN DARWIN But the script below gives me all 6 letter and more entries. What I read says {6} means exactly 6. What is the correct RE? I have solved the problem my using if (length($data[1]) == 6 ) but wou

regex help

2011-10-10 Thread Chris Stinemetz
Any help is appreciated. Once I match HEH how can alter the program to print the contents that are in the two lines directly above the match? For example in this case I would like the print results to be: **01 REPT:CELL 983 CDM 1, CCU 1, CE 5, HEHTimestamp: 10/10/11 00:01:18 #!/usr/bin/per

regex help

2011-10-17 Thread Chris Stinemetz
Hello, I am getting the following error when I am trying to use regex to match a pattern and then access the memory variables: Any insight as to what I am doing wrong is greatly appreciated. Thank you, Chris Use of uninitialized value $1 in hash element at ./heh.pl line 22, <$fh> lin

Re: regex

2011-11-04 Thread Jim Gibson
On 11/4/11 Fri Nov 4, 2011 10:42 AM, "Chris Stinemetz" scribbled: > I am trying to match a line that has HEH in it. > > I would also like to store the number follow CELL in memory variable $1 > and store everything following the number and upto excluding ", HEH" in > memory variable $2 > > so

Re: regex

2011-11-04 Thread Sheppy R
This should do it - m/Cell (\d+)(.*), HEH/ On Fri, Nov 4, 2011 at 1:42 PM, Chris Stinemetz wrote: > I am trying to match a line that has HEH in it. > > I would also like to store the number follow CELL in memory variable $1 > and store everything following the number and upto excluding ", HEH"

Re: regex

2011-11-04 Thread Shawn H Corey
On 11-11-04 01:42 PM, Chris Stinemetz wrote: I am trying to match a line that has HEH in it. I would also like to store the number follow CELL in memory variable $1 and store everything following the number and upto excluding ", HEH" in memory variable $2 so this line: Cell 999 CDM 1, 2, CBR 1

Re: regex

2011-11-04 Thread Chris Stinemetz
> > > > Try this: > > "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; > print "<$1> <$2>\n"; > > Thank you Jim. This did the trick! Do you mind explaining how you did this? I'm trying to make

Re: regex

2011-11-04 Thread Brandon McCaig
On Fri, Nov 04, 2011 at 02:56:35PM -0500, Chris Stinemetz wrote: > Thank you Jim. This did the trick! Do you mind explaining how you did this? > I'm trying to make sense of it with my perl regex cheat sheet I found > online. Execute the following commands to read the docs: perldoc

Re: regex

2011-11-04 Thread Uri Guttman
On 11/04/2011 03:56 PM, Chris Stinemetz wrote: Try this: "Cell 999 CDM 1, 2, CBR 1, 15MHz, HEH" =~ /Cell\s*(\d+)\s*(.*),\s*HEH/; print "<$1> <$2>\n"; Thank you Jim. This did the trick! Do you mind explaining how you did this? I'm trying to make

Re: regex

2011-11-04 Thread Jim Gibson
;> > > > Thank you Jim. This did the trick! Do you mind explaining how you did this? > I'm trying to make sense of it with my perl regex cheat sheet I found > online. > > http://www.erudil.com/preqr.pdf I don't think I could improve on the extended regex with

Re: regex

2011-11-04 Thread Chris Stinemetz
Sorry for the duplicate Jim. I meant to reply all on the original. On Fri, Nov 4, 2011 at 3:33 PM, Chris Stinemetz wrote: > > > >> I don't think I could improve on the extended regex with comments posted >> by >> Shawn H. Corey. His regex is the same as mine,

Re: regex

2012-04-08 Thread Binish A.R
Why don't you check the length of the string as well .. ie if (length($word) ==  5 && $word =~ /^(un|in|non).+$/) {  ## Do something }   From: Somu To: beginners@perl.org Sent: Sunday, April 8, 2012 4:30 PM Subject: regex Hello everyone... T

Re: regex

2012-04-08 Thread Binish A.R
if you are  looking for the regex only solution, then you may try this $word =~ /^((un|in).{3}|non.{2})$/   From: Binish A.R To: "som@gmail.com" ; "beginners@perl.org" Sent: Sunday, April 8, 2012 6:19 PM Subject: Re: regex Why

Re: regex

2012-04-08 Thread Somu
yes... Maybe have to work with this only... Thanks $word =~ /^((un|in).{3}|non.{2})$/

Re: regex

2012-04-08 Thread Rob Dixon
On 08/04/2012 12:00, Somu wrote: Hello everyone... Thanks for the previous replies. I'm really improving! A new problem.. Check if the word begins with un or in and has exactly 5 letters. $word =~ '^(un|in).{3}$' Check if the word begins with un or in or non and has more than 5 letters. $word

Re: regex

2012-04-08 Thread John W. Krahn
Somu wrote: Hello everyone... Hello, Thanks for the previous replies. I'm really improving! A new problem.. Check if the word begins with un or in and has exactly 5 letters. $word =~ '^(un|in).{3}$' You should use the matching operator on the right hand side of the binding operator instea

Re: regex

2012-04-09 Thread Somu
WOW!!! Still to see the world... Thanks :) On Mon, Apr 9, 2012 at 4:04 AM, John W. Krahn wrote: > Somu wrote: > >> Hello everyone... >> > > Hello, > > > Thanks for the previous replies. I'm really improving! >> A new problem.. >> >> Check if the word begins with un or in and has exactly 5 lette

Regex again..

2012-04-14 Thread Somu
*Hi all, I was trying to strip off all html tags and the special characters from a html file using regex. my code is as follows.. * use strict; use warnings; sub strip_html{ my $line = shift; #something wrong in the following

Perl regex

2012-07-01 Thread Chris Stinemetz
I have a two line pattern I would like to match and include 3 groupings. 59 REPT: EVDO: RNC 24 CP FAILURE SUMMARY SESSION RELEASE RAN AUTH FAILURE PPP, ERROR CODE 51001 For final outcome I would like: $1 = 24 $2 = CP FAILURE SUMMARY SESSION RELEASE RAN AUTH FAILURE PPP $3 = ERROR CODE 510

Regex help

2012-12-22 Thread punit jain
stances. So o/p should be :- BEGIN:VCARD VERSION:2.1 EMAIL:te...@test.com FN:test1 REV:20101116T030833Z UID:644938456.1419. END:VCARD BEGIN:VCARD VERSION:2.1 EMAIL:te...@test.com FN:test2 REV:20101116T031015Z UID:644938507.1420 END:VCARD I am using below regex :- my $fh = IO::File->new(&q

Regex issue

2013-01-03 Thread punit jain
Hi, I am facing issues in parsing using Regex. The problem definition is as below : - A file with data :- BEGIN country Japan passcode 1123 listname sales contact ch...@example.com contact m...@example.com END BEGIN country Namibia passcode 9801 listname dept contact l...@example.com END

Regex help

2005-01-15 Thread Ajey Kulkarni
ound signs, precided by a base in decimal. Eg: 16#6.a7#e+2, 18.9, I've ([0-9_]+(#[0-9]+\.[0-9a-fA-F]*#e[0-9]*)?) regex to match it, but i'm somwhere goofing up after the dec point. Can any one help me out? regards -A -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

regex needed

2005-01-18 Thread Chris Knipe
Lo everyone, Can someone please give me a regex to parse the following... Flags: X - disabled, I - invalid, D - dynamic, J - rejected, C - connect, S - static, r - rip, o - ospf, b - bgp #DST-ADDRESSG GATEWAY DISTANCE INTERFACE 0 S 0.0.0.0/0 r 198.19.0.2 1

regex explanation?

2005-04-13 Thread Graeme McLaren
Morning all, would anyone be able to explain this regular expression: /^[\w ,.!?\-'"\(\)\s]+$/ I'm going to read up on it but I'm in a hurry for this. Cheers, Graeme :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

regex substitution

2005-04-27 Thread Ramprasad A Padmanabhan
Hi all, I want a regex to replace all continuous occurrences of '-' with something else say 'x' except the first one These are some examples "- Ram" ===> "- Ram" "-- bla"===> "-x blah&q

bulky regex

2005-04-27 Thread Peter Rabbitson
Hello everyone, This is the first time I was able to get a complex regex actually working as I expect, but I wanted someone to comment on it, in case I am overlooking something very major. I am trying to throw away a certain string out of random text. The occurences might be as follows: Free

Regex needed

2005-06-09 Thread Robert
I have a log file where the last portion of the events look like: Printer driver: (Lexmark T520) Where the portion in parens will change but it will always look like that. Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Regex help

2005-06-25 Thread Owen
I have a script with these three lines and it works $line =~ s/^\s*//; # Remove leading spaces next if ($line =~ /^#/);# Skip line if it starts with # next if ($line =~ /^\s*$/); # Ship blank lines I can replace lines 1 and 2 above with next if($line =~ /\s+|#/); Howeve

regex problem

2005-07-01 Thread Moon, John
The following is not returning what I had expected... SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/123};print "Yes - $a like $home\n" if $a =~ /^$home/;' SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/ra};print "Yes - $a like $home\n" if $a =~ /^$home/;' SUN1-BATCH>perl -e '$a=q{/var/run}; $

regex puzzle

2005-07-28 Thread bingfeng zhao
See following sample code: use warnings; use strict; my @address = ("http://test";, "http://";, "www", "", "ftp:/foo" ); for (@address) { print "\"$_\" passed! \n" if /^((http|ftp):\/\/)?.+$/; } the running result is: "http://test"; is valid. "http://"; is valid. "www" is valid. "ftp:/

class regex

2005-08-29 Thread Brent Clark
Hi list I have im trying to enhance my regex skill. My questions is, would m/^p11[016]/io match like m/^(p110|p111|p116)/io Any tips or advice, would greatfully be appreciated. Kind Regards Brent Clark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Regex $1

2005-09-17 Thread Chad
I have a file with the following: (0 rows affected) SQL1\SQLPROD4 When I run the following code it finds my match, but why isn't $1 populated? $/ = ''; open (VALIDFILE, "valid.txt") || die "Couldn't open file: $!"; while ( ) { if (/SQL1\\SQLPROD4/) { print "The text

regex headache

2014-02-03 Thread Paul Fontenot
Hi, I am attempting to write a regex but it is giving me a headache. I have two log entries 1. Feb 3 12:54:28 cdrtva01a1005 [12: 54:27,532] ERROR [org.apache.commons.logging.impl.Log4JLogger] 2. Feb 3 12:54:28 cdrtva01a1005 [12: 54:27,532] ERROR [STDERR] I am using the following "^\w+

split regex

2015-03-19 Thread Danny Wong (dannwong)
a partial return of "Initial Baseline” (returns Initial). Is there a regex where I can split using space as the delimiter, but get all the words inside a quote string?

regex problem?

2015-11-25 Thread Rick T
The following code apparently is not doing what I wanted. My intention was to confirm that the general format of $student_id was this: several uppercase letters followed by a hyphen followed by several digits. If not, it would trigger the die. Unfortunately it seems to always trigger the die. F

Re: regex

2024-01-22 Thread karl
Jorge Almeida: > Please help me to understand this: > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' > $ echo $? > $ 10 In man perlre, under "Regular Expressions" it says: {,n}Match at most n times So /a{,2}/ matches "", "a", and "aa" and is ignorant about what comes before and after (basica

Re: regex

2024-01-22 Thread karl
Jorge Almeida: > On Mon, 22 Jan 2024 at 13:00, wrote: > > Jorge Almeida: > > > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' ... > > {,n}Match at most n times ... > Yes, I read it (several times). I still don't understand it (I understand > what you're saying, and I trust you're right, I just

Re: regex

2024-01-22 Thread Andy Bach
aa"=~/a{,2}/;' Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/a{ <-- HERE ,2}/ at -e line 1. and % perldoc perlre says Quantifiers Quantifiers are used when a particular portion of a pattern needs to match a certain number (or numbers)

Re: regex

2024-01-22 Thread Levi Elias Nystad-Johansen via beginners
I agree that this is confusing, and I think many resources describing regex in unhelpful ways is partly to blame. descriptions like "pattern that matches against a string" and similar. this implies that a regex has to match the string, but this is not the case. a regex does not have to

RE: regex

2024-01-22 Thread Claude Brown via beginners
Jorge, Expanding on Karl's answer (and somewhat labouring his point) consider these examples: $a =~ /Jorge/ $a =~ /^Jorge/ $a =~ /Jorge$/ $a =~ /^Jorge$/ This shows that regex providing four different capabilities: - detect "Jorge" anywhere in the string - detect "Jorg

Re: regex

2024-01-22 Thread armando perez pena
have a problem and you say I will solve it with regular expressions then you have two problems. Ánimos! Saludos From: Claude Brown via beginners Sent: Monday, January 22, 2024 10:49:50 PM To: k...@aspodata.se ; beginners@perl.org Subject: RE: regex Jorge

Re: regex

2024-01-22 Thread Mike
Why is my Perl not working on that command? $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/a{ <-- HERE ,2}/ at -e line 1. $ But this works: $ perl -e 'exit(10) if "aaa"=~/a{0,2

Re: regex

2024-01-23 Thread karl
Please stop using my mail address when replying, I'm on the list and don't want two copies of the same mail (it's not about you Mike). Mike > Why is my Perl not working on that command? > > $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' > Unescaped left

Re: regex

2024-01-23 Thread Mike
I stand properly scolded. Mike On 1/23/24 07:01, k...@aspodata.se wrote: Please stop using my mail address when replying, I'm on the list and don't want two copies of the same mail (it's not about you Mike). -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional command

Re: regex

2024-01-24 Thread karl
Mike: > I stand properly scolded. I didn't want to scold anyone, it seems I expressed myself wrong. Sorry for that. Regards, /Karl Hammar -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

regex issues

2005-11-01 Thread Michael Gargiullo
my $splitt=$dynparsparts[1]; In the example above $splito="certificate:" and $splitt="Solution" my @parts=split(/$splito/,$problem); The line above fails halfway through with the following error: Quantifier follows nothing in regex; marked by <-- HERE in m/

regex heck

2005-11-03 Thread Tom Allison
I've been playing with some regex, Benchmark, and 'slurping' and found something that I could do (If I could get it to work) but not sure I want to do it. Benchmark: reading a file using: my $line = do {local $/; <$file>}; versus; while (<$file>) {

RE: Regex

2005-11-07 Thread Timothy Johnson
If you are using DBI, there is a $dbh->quote() method that will do what you want. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 11:34 AM To: beginners@perl.org Subject: Regex I have a field that looks like t

RE: Regex

2005-11-07 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : I have a field that looks like this: : : 'modprobe: modprobe: Can't locate module char-major-10-134' : : I need to add a single quote so that it looks like this: : : 'modprobe: modprobe: Can''t locate module char-major-10-134' : : But I hav

RE: Regex

2005-11-07 Thread Ward.P.Fontenot
Yes they are -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 12:46 PM To: Fontenot, Ward P. Subject: RE: Regex Are the outer quotes part of the field? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent

RE: Regex

2005-11-07 Thread Timothy Johnson
What about stripping the outer quotes using Perl and then using $dbh->quote? My concern is that if you try to use a regex it will end up being more complicated than necessary if you try to factor in all of the possibilities. -Original Message- From: [EMAIL PROTECTED] [mailto:[EM

RE: Regex

2005-11-07 Thread Ward.P.Fontenot
s it alittle clearer than mud :) -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 12:57 PM To: Fontenot, Ward P. Cc: beginners@perl.org Subject: RE: Regex What about stripping the outer quotes using Perl and then using $dbh->quote? M

Re: Regex

2005-11-07 Thread Bob Showalter
[EMAIL PROTECTED] wrote: I have a field that looks like this: 'modprobe: modprobe: Can't locate module char-major-10-134' I need to add a single quote so that it looks like this: 'modprobe: modprobe: Can''t locate module char-major-10-134' But I have no idea how to go about doing that, can I

RE: Regex

2005-11-07 Thread Ward.P.Fontenot
Thanks a million, that one did it -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Monday, November 07, 2005 1:55 PM To: Fontenot, Ward P. Cc: beginners@perl.org Subject: Re: Regex [EMAIL PROTECTED] wrote: > I have a field that looks like this: > >

regex question

2005-11-08 Thread Tom Allison
if ($text =~ /(.*?($crlf))\2(.*)/sm) { Do I read this right? the '\2' is a repeat character of the second match where match \1 is (.*?$crlf) and match \2 is $crlf ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

regex compares

2005-11-13 Thread Pant, Hridyesh
What does this regex compares my $patternDir = '^[a-zA-Z0-9/_.\[\]-]*$' Thanks Hridyesh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

  1   2   3   4   5   6   7   8   9   10   >