hello all!
I'd like to request for help with this regexp. I want match
these examples:
word word
3 word word
3 word word en
3 word word en,pt
3 word word en,pt 1cd
ok, here is regexp I wrote:
Brano Gerzo schreef:
hello all!
I'd like to request for help with this regexp. I want match
these examples:
word word
3 word word
3 word word en
3 word word en,pt
3 word word en,pt 1cd
ok, here is regexp I wrote:
^\s*(\d{1,2}\s+)?([\w\s\+:]+)
Dr.Ruud [DR], on Thursday, July 13, 2006 at 21:05 (+0200) made these
points:
DR I don't understand what you try to match with [\w\s\+:]+. It matches
DR any series of characters that belong to the character class containing
DR [[:word:]], [[:space:]], a plus and a colon. So a b :c would match.
Brano Gerzo am Donnerstag, 13. Juli 2006 21:23:
[...]
yes, my example was ambiguous sorry, for that. Here are more examples:
word
word word
word word word
1 word
1 word word word
1 word en,pt,sk
1 word en 1cd
so:
- first digits are optional
- then it is followed by word(s), which are
D. Bolliger [DB], on Thursday, July 13, 2006 at 21:48 (+0200) typed
the following:
DB This data format is ambigous, consider:
I know, but I count with it in this case. This regexp is used only for
commands to bots, so there should be some small errors in parsing :)
if it passes to language,
Dr.Ruud [DR], on Thursday, July 13, 2006 at 21:05 (+0200) wrote these
comments:
as you helped me much, here is example of RE:
my $re =
Brano Gerzo schreef:
Dr.Ruud [DR], on Thursday, July 13, 2006 at 21:05 (+0200) made these
points:
I don't understand what you try to match with [\w\s\+:]+. It
matches any series of characters that belong to the character class
containing [[:word:]], [[:space:]], a plus and a colon. So a b :c
Brano Gerzo schreef:
Dr.Ruud [DR], on Thursday, July 13, 2006 at 21:05 (+0200) wrote these
comments:
as you helped me much, here is example of RE:
my $re =
'^\s*(?:(\d+)\s+)?(\w+(?:\s+\w+)*?)(?:\s+((?:sq|hy|ay|bs|bg|hr|cs|da|nl|
Dr.Ruud schreef:
Slight revision, that fails on the last line:
More assuming revision:
#!/usr/bin/perl
use warnings ;
use strict ;
sub SOB { '\A' }
sub EOB { '\z' }
sub OR { join '|', @_ }
sub sp { '[[:blank:]]+' }
sub capture { (@_) }
sub optional {
-Original Message-
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 13, 2006 5:24 PM
To: beginners@perl.org
Subject: Re: Regexp help please
Dr.Ruud schreef:
Slight revision, that fails on the last line:
More assuming revision:
#!/usr/bin/perl
use warnings ;
use
Smith, Derek schreef:
Dr.Ruud:
sub SOB { '\A' }
sub EOB { '\z' }
Are all these considered anonymous sub-routines?
No, see `perldoc perlsub`.
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
11 matches
Mail list logo