Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread C.DeRykus
On Aug 25, 7:01 am, jwkr...@shaw.ca ("John W. Krahn") wrote: > Honza Mach wrote: > > Hi everybody, > > Hello, > > > > > > > > > > > I was wondering, if it is possible to use backreferences in the pattern > > repetition bracket operator. > > > Consider the following string: > > > my $string = "5 abc

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Randal L. Schwartz
>>>>> "Honza" == Honza Mach writes: Honza> Hi everybody, In the subject, you mention "PCRE". Are you actually using PCRE, and not Perl? If so, this mailing list isn't for you, because PCRE is misnamed: it isn't Perl, and it's not even Pe

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread John W. Krahn
Honza Mach wrote: Hi everybody, Hello, I was wondering, if it is possible to use backreferences in the pattern repetition bracket operator. Consider the following string: my $string = "5 abcdefghijklmn"; The number five at the beginning of the string means, that I want to extract first fiv

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Honza Mach
Hi, On Thu, 2011-08-25 at 12:54 +0200, Paul Johnson wrote: > On Thu, Aug 25, 2011 at 12:02:37PM +0200, Honza Mach wrote: > > Hi, > > > > On Thu, 2011-08-25 at 11:35 +0200, Paul Johnson wrote: > > > > > > say "extracted: ", /^(\d+\s+.{$len})/ if ($len) = /^(\d+)/ > > > Sometimes two passes are

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Paul Johnson
On Thu, Aug 25, 2011 at 12:02:37PM +0200, Honza Mach wrote: > Hi, > > On Thu, 2011-08-25 at 11:35 +0200, Paul Johnson wrote: > > > > say "extracted: ", /^(\d+\s+.{$len})/ if ($len) = /^(\d+)/ > > Sometimes two passes are are better than one. > > > > Thank you for your advice, however I wanted

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Honza Mach
Hi, On Thu, 2011-08-25 at 11:35 +0200, Paul Johnson wrote: > > > On Thu, 25 Aug 2011 10:42:20 +0200 > > > Honza Mach wrote: > > > > > > > Hi everybody, > > > > > > > > I was wondering, if it is possible to use backreferences in the pattern > > > > repetition bracket operator. > > > > > > > > C

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Paul Johnson
> > On Thu, 25 Aug 2011 10:42:20 +0200 > > Honza Mach wrote: > > > > > Hi everybody, > > > > > > I was wondering, if it is possible to use backreferences in the pattern > > > repetition bracket operator. > > > > > > Consider the following string: > > > > > > my $string = "5 abcdefghijklmn"; >

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Honza Mach
Hi Schlomi, thank you so much for such a quick response. On Thu, 2011-08-25 at 11:56 +0300, Shlomi Fish wrote: > ׁHi Honza, > > On Thu, 25 Aug 2011 10:42:20 +0200 > Honza Mach wrote: > > > Hi everybody, > > > > I was wondering, if it is possible to use backreferences in the pattern > > repeti

Re: PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Shlomi Fish
ׁHi Honza, On Thu, 25 Aug 2011 10:42:20 +0200 Honza Mach wrote: > Hi everybody, > > I was wondering, if it is possible to use backreferences in the pattern > repetition bracket operator. > > Consider the following string: > > my $string = "5 abcdefghijklmn"; > > The number five at the beginn

PCRE: Use backreference in pattern repetition bracket

2011-08-25 Thread Honza Mach
Hi everybody, I was wondering, if it is possible to use backreferences in the pattern repetition bracket operator. Consider the following string: my $string = "5 abcdefghijklmn"; The number five at the beginning of the string means, that I want to extract first five characters from the latter p

OT Postfix PCRE zero-width match: /(?:)/

2004-04-20 Thread WC -Sx- Jones
cated.] My corrected case: #! perl use strict; use warnings; $_ = "aaa"; print "no 'a' matched" unless /a/; my $idx; while () { ++$idx; print "Line $idx - seen $_" if /(?:)/; } __DATA__ Line 3 Line 5 Postfix uses PCRE for implementing Regular Expression

Re: PCRE

2004-04-17 Thread WC -Sx- Jones
Charles K. Clarkson wrote: WC -Sx- Jones <[EMAIL PROTECTED]> wrote: : : PCRE 4.5 revisited :( What's PCRE 4.5? pcre.org - PCRE 4.5 is the latest Perl Code Regular Expression extension which can be "compiled" into other systems -- to allow such systems to use Perl-like

Re: PCRE

2004-04-17 Thread WC -Sx- Jones
WC -Sx- Jones wrote: What I was shooting for - /213\.37\.(?:150...251)\.(?:0...255)/ Hell, for that matter - what is the proper syntax for: #! /usr/local/bin/perl -w use strict; use warnings; my ($first, $second, $third, $fourth, $x, $ip) = (213, 37, 150, 0); $ip = "$first.$second.$third.$fourth

RE: PCRE

2004-04-17 Thread Charles K. Clarkson
WC -Sx- Jones <[EMAIL PROTECTED]> wrote: : : PCRE 4.5 revisited :( What's PCRE 4.5? : I am trying to reduce this into something "smaller/shorter" - : /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0-1]\.\ d{1,3}/ Let's break it

Re: PCRE

2004-04-17 Thread WC -Sx- Jones
Randy stated: > /213\.37\.(?:1[5-9][0-9]|2(?:[1-4][0-9]|5[0-1]))\.\d{1,3}/ Thanks. I guess the Range Operator .. ... still doesn't work inside R/Es What I was shooting for - /213\.37\.(?:150...251)\.(?:0...255)/ LOL :) Bill -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

Re: PCRE

2004-04-17 Thread Randy W. Sims
On 4/17/2004 11:59 AM, WC -Sx- Jones wrote: WC -Sx- Jones wrote: PCRE 4.5 revisited :( I am trying to reduce this into something "smaller/shorter" - /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0-1]\.\d{1,3}/ Sorry - I don't mean to be vague. I nor

Re: PCRE

2004-04-17 Thread WC -Sx- Jones
WC -Sx- Jones wrote: PCRE 4.5 revisited :( I am trying to reduce this into something "smaller/shorter" - /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0-1]\.\d{1,3}/ Sorry - I don't mean to be vague. I normally would use a CIDR to match:

Re: PCRE

2004-04-17 Thread James Edward Gray II
On Apr 17, 2004, at 10:10 AM, WC -Sx- Jones wrote: PCRE 4.5 revisited :( I am trying to reduce this into something "smaller/shorter" - /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0 -1]\.\d{1,3}/ Obviously I am brain dead =/ I have tried - /213\.37\.[15

Re: PCRE

2004-04-17 Thread Randy W. Sims
On 4/17/2004 11:10 AM, WC -Sx- Jones wrote: PCRE 4.5 revisited :( I am trying to reduce this into something "smaller/shorter" - /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0-1]\.\d{1,3}/ Obviously I am brain dead =/ I have tried - /213\.37\.[150-25

PCRE

2004-04-17 Thread WC -Sx- Jones
PCRE 4.5 revisited :( I am trying to reduce this into something "smaller/shorter" - /213\.37\.(?:(?:(?:1(?:[5-9][0-9])|(?:2(?:0|1|2|3|4)[0-9])|(?:25[0-1]\.\d{1,3}/ Obviously I am brain dead =/ I have tried - /213\.37\.[150-251]\.[0-255]/ or /213\.37\.(?:[150-251])\.(?:[0-255])

Re: Reducing RegEx (pcre)

2004-03-23 Thread Jenda Krynicky
the reply :) As always your code > leaves me wondering if I will ever learn Perl :) Thanks for the compliment :-) > I tested the code and it works great - except I > am having trouble implementing it as one line in > my Postfix SMTP body checks pcre :) I see. I did not know wha

Re: Reducing RegEx (pcre)

2004-03-23 Thread WC -Sx- Jones
trouble implementing it as one line in my Postfix SMTP body checks pcre :) The clients do not wish to install spam assassin -- which would be better at catching this sort of spam. The original RE was a one line match to catch html which started with G J K Y Z - and except for K none of the others start

Re: Reducing RegEx (pcre)

2004-03-23 Thread Jenda Krynicky
|$)} {HTML::Entities::encode($1, '^\r\n\t !\#\$%\"\'-;=?- ~').$2}gem; } return $str; } first to "polish" the HTML and escape the stuff that does no look like proper HTML and then use something like HTML::JFilter or HTML::Filter

Re: Reducing RegEx (pcre)

2004-03-20 Thread WC -Sx- Jones
James Edward Gray II wrote: m/\s+\w+\<(?:[gjyz].*|k\w{3,})\>\w+\s+/ That works great :) ( minus the m of course. ) Thx :) Bill -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Reducing RegEx (pcre)

2004-03-20 Thread James Edward Gray II
On Mar 20, 2004, at 6:17 PM, WC -Sx- Jones wrote: Greetings: Comments about how to perform these 5 checks as ONE TEST are welcome - /\s+\w+\\w+\s+/ REJECT Invalid HTML Spam vG /\s+\w+\\w+\s+/ REJECT Invalid HTML Spam vJ /\s+\w+\\w+\s+/ REJECT Invalid HTML Spam vK /\s+\w+\\w+\s+/ REJECT Invalid HT

Reducing RegEx (pcre)

2004-03-20 Thread WC -Sx- Jones
Spam vZ I am not interested in a Perl module as the "pcre" environment I am using would require huge CPU eating filters. Maybe something like this working/production code: /\s+\w+\<(?=g|j|y|z).*\>\w+\s+/ REJECT Invalid HTML But I am not sure how to handle the K (kbd) which ultimatel

Re: PCRE Range Matching

2003-06-02 Thread WC -Sx- Jones
[PMFJI] Following up to my own post - On Sunday, June 1, 2003, at 07:58 PM, WC -Sx- Jones wrote: /(37.3,200)/; # matches any number x, 37.3 < x < 200 /((37.3,200))/; # matches any number x, 37.3 < x < 200 and saves it ... But I cannot seem to get the simple test case working

PCRE Range Matching

2003-06-02 Thread WC -Sx- Jones
I am writing a complex PCRE for my Postfix mail server and I would like to use something along the lines of: /(37.3,200)/; # matches any number x, 37.3 < x < 200 /((37.3,200))/; # matches any number x, 37.3 < x < 200 and saves it /([37,))/; # matches a