> -Original Message-
> From: p sena [mailto:senapati2...@yahoo.com]
> Sent: 05 March 2011 05:34
> To: perl-win32-users@listserv.ActiveState.com; Brian Raven
> Subject: RE: regex like option *values*
>>>>> __DATA__
>>>>> abc0[1-9].ctr.[pad,spd]
> > >> __DATA__
> > >> abc0[1-9].ctr.[pad,spd].set.in
> > >> abc[01-22].ctr.[pad,spd].set.in
> > >> abcL[1,2,3].ctr.[pad,spd].set.in
> > >> abcL[1,2,3].ctr.[pad,spd].set.in
> > >> abcL[1,2,3].ctr.[70,001].set.in
> > >>
> > ---
> > >>
> > >> It should
> >> __DATA__
> >> abc0[1-9].ctr.[pad,spd].set.in
> >> abc[01-22].ctr.[pad,spd].set.in
> >> abcL[1,2,3].ctr.[pad,spd].set.in
> >> abcL[1,2,3].ctr.[pad,spd].set.in
> >> abcL[1,2,3].ctr.[70,001].set.in
> >>
> ---
> >>
> >> It should work for lists of ra
> -Original Message-
> From: p sena [mailto:senapati2...@yahoo.com]
> Sent: 03 March 2011 15:40
> To: perl-win32-users@listserv.ActiveState.com; Brian Raven
> Subject: RE: regex like option *values*
>> __DATA__
>> abc0[1-9].ctr.[pad,spd].set.in
>> abc[01
> __DATA__
> abc0[1-9].ctr.[pad,spd].set.in
> abc[01-22].ctr.[pad,spd].set.in
> abcL[1,2,3].ctr.[pad,spd].set.in
> abcL[1,2,3].ctr.[pad,spd].set.in
> abcL[1,2,3].ctr.[70,001].set.in
> ---
>
> It should work for lists of ranges, and ranges of strings
> -Original Message-
> From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-
> win32-users-boun...@listserv.activestate.com] On Behalf Of p sena
> Sent: 02 March 2011 17:16
> To: perl-win32-users@listserv.ActiveState.com
> Subject: regex like option *values*
>
> Hi,
>
> I wa
First convert the links then strip the html tags.
$text =~ s/(.+?)/[$1] {$2}/ig;
--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"
0100
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
Unpack is even faster, for fixed-format strings.
dZ.
On Mar 24, 2006, at 22:19, Chris Wagner wrote:
At 10:38 AM 3/24/2006 -0700, Paul Rousseau wrote:
I am looking for help on a regex that examines strings such as
"xxxN yyy sssNNN"
"xxxN yyyNyyy sss"
"xxxN yyyNyyy ssN"
At 10:38 AM 3/24/2006 -0700, Paul Rousseau wrote:
> I am looking for help on a regex that examines strings such as
>
>"xxxN yyy sssNNN"
>"xxxN yyyNyyy sss"
>"xxxN yyyNyyy ssN"
>
>and returns only the sss part? N is always a numeral, and s is always
>alphabetic.
Do u have to examine
Try this:
$string =~ /^.{3}\d\s[^\s]+\s([a-zA-Z]+)\d+$/;
$prefix = $1;
That should match:
- any three characters at the beginning of the string: ^.{3}
- followed by a number: \d
- followed by whitespace: \s
- followed by any one or more characters until the next whitespace [^\s]+
-
Something like this :
/(\w\s){2}([a-zA-Z]+)\d*/
David
Joe Discenza wrote:
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM
:I am looking for help on a regex that examines strings such as
:
: "xxxN yyy sssNNN"
: "xxxN yyyNyyy sss"
: "xxxN yyyNyyy ssN"
:
: and returns
Paul,
Give this a shot:
/^\w+\s+\w+\s+([A-Za-z]+)\d+/
A regex should be as explicit and exclusive as possible, so I would
remove the lowercase (a-z) portion of the character class if you know
for sure that the letters you want will always be uppercase.
-Brian
_
Bria
$string = "MBH1 WELL PIT050";
$string =~ s/.* (.*?)\d+/\1/; # Questionmark makes it
non-greedy
($prefix) = $string; # Didn't figure out how
to do ($prefix) = $string =~
print "$prefix";
<>;
**
Hello,
I am looking for help on a
[EMAIL PROTECTED] wrote:
> Hello,
>
>I am looking for help on a regex that examines strings such as
>
> "xxxN yyy sssNNN"
> "xxxN yyyNyyy sss"
> "xxxN yyyNyyy ssN"
>
> and returns only the sss part? N is always a numeral, and s is always
> alphabetic.
>
> Here is what I have so
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM
:I am looking for help on a regex that examines strings such as
:
: "xxxN yyy sssNNN"
: "xxxN yyyNyyy sss"
: "xxxN yyyNyyy ssN"
:
: and returns only the sss part? N is always a numeral, and s
: is always alphabetic.
Does
Not sure I'm getting it completely, but using match in a while loop w/ the
/g modifier lets you process a string one match at a time:
my $string = "Lots of words to be read one at a time.\nthough more than
one line";
while ( $string =~ /(\w+)/g ) {
print "Found: $1\n";
print "Proceessing ..
Joe Discenza wrote:
"Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58
replacement is so complex that it cannot be
expressed as a straight substitution. So I would have to find a
piece of text, process it in a separate function, and replace the
matched text with the newly computed text. This goes
Kenneth McNamara wrote:
You're implying that the music macro language is pos() sensitive.
That is a pretty severe problem in itself.
Hmm, I'm not totally sure if it is. But true certain modifiers apply until
the next note, such as one or more periods. My MML experience is actually
from trying t
Title: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString
"Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58: Yet another newbie question about regular
expressions:: I'd like to find and replace bits of text as usual. However,
rather than: replace all occurrences in one
Veli-Pekka
You're implying that the music macro language is pos() sensitive.
That is a pretty severe problem in itself.
Can you output the macro language in a format that is not position
sensitive - do a global change - then process the macro language back
into original format?
I thin
So what ur saying is that u want to do a lot of substitutions in one pass.
U could always have one s///g for each thing u want substituted and run it n
times. Can u post some actual strings that u want to parse and the
substitutions? Then we can figure it out.
At 10:58 PM 10/9/05 +0300, =?iso-88
Chris Wagner wrote:
> At 05:11 PM 9/27/05 -0700, $Bill Luebkert wrote:
>
>>\s* means to grab any WS at the current position (including the case where
>> there is none).
>>
>>\s*? means 0 or 1 of the above which is totally meaningless - you've already
>> eaten all the WS with the \s*, so in my
At 05:11 PM 9/27/05 -0700, $Bill Luebkert wrote:
>\s* means to grab any WS at the current position (including the case where
>there is none).
>
>\s*? means 0 or 1 of the above which is totally meaningless - you've already
>eaten all the WS with the \s*, so in my opinion the ? is redundant t
Chris Wagner wrote:
> At 12:08 AM 9/27/05 -0700, robert johnson wrote:
>
>>and by the way, *? is redundant.
>>* means zero or more.
>>? means zero or one.
>
>
>
> Actually the *? construct is not a redundancy. It calls for a minimal match
> rather than a maximal match, which is the default.
At 12:08 AM 9/27/05 -0700, robert johnson wrote:
>and by the way, *? is redundant.
>* means zero or more.
>? means zero or one.
Actually the *? construct is not a redundancy. It calls for a minimal match
rather than a maximal match, which is the default. Although it was useless
in the example.
David Budd wrote:
I thought this was working, but my logs just showed a case where it
seems not to do what I want.
Why does:
$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
Not become true when $body contains:
Library Card: 0240742
i'd bet that it passes when you have some whitespace af
At 02:42 PM 9/25/05 +1000, [EMAIL PROTECTED] wrote:
>> Why does:
>> $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
>> Not become true when $body contains:
>> Library Card: 0240742
>Having looked at other replies to this, isn't it irrelevant what comes
>after the "(\d{7})" part of the re.
It'
John wrote:
> David Budd wrote:
>
>>I thought this was working, but my logs just showed a case where it seems not
>>to do what I want.
>>Why does:
>>$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
>>Not become true when $body contains:
>>Library Card: 0240742
>>
>>Just possibly there's some
David Budd wrote:
I thought this was working, but my logs just showed a case where it seems not
to do what I want.
Why does:
$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
Not become true when $body contains:
Library Card: 0240742
Just possibly there's some dodgy html or something in the o
At 09:07 AM 9/21/05 +0100, [EMAIL PROTECTED] wrote:
>> You state that there must be a NON numeric at end of
>> line. I would have \D* or \D*$.
>
>Excellent suggestion. I shall implement it forthwith.
Actually, to make sure ur string ends with a non-numeric u need \D$ not
\D*$. \D* matches 0
>
> You state that there must be a NON numeric at end of
> line. I would have \D* or \D*$.
Excellent suggestion. I shall implement it forthwith.
Part of the reason I was perplexed was that this script ran for a year with
nobody complaining.
In fact, I discovered some time after I'd post
David wrote:
>I thought this was working, but my logs just showed a case where it seems
>not to do what I want.
>Why does:
>$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
>Not become true when $body contains:
>Library Card: 0240742
>Just possibly there's some dodgy html or something in the o
[EMAIL PROTECTED] wrote:
> I thought this was working, but my logs just showed a case where it
> seems not to do what I want.
> Why does:
> $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
> Not become true when $body contains:
> Library Card: 0240742
>
> Just possibly there's some dodgy html
David Budd wrote:
> I thought this was working, but my logs just showed a case where it seems not
> to do what I want.
> Why does:
> $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;
What's the last \D for ? '\s*?' should just be '\s*' - same with \D*?.
> Not become true when $body contains:
Perhaps you need to change the final \D to \D* since it is possible that
there is nothing after the 7 digits. Or perhaps omit the last \D completely.
Your code works with;
$body='Library Card: 0240742 '; # has a character after the 7 digits
but fails with;
$body='Library Card: 0240742';
The string $body ("Library Card: 0240740") does not end in \D ("not a
number"). You might want to add a * to that if you want to make sure it
matches strings that _do_ end in \D (ie. \n or \r\n or whatever stuff comes
behind the "ID") and those that end in the ID itself.
- Original Message
Title: Regex
David Budd wrote, on Tue 9/20/2005 10:57:
: I thought this was working, but my logs just showed a case
where it seems not to do what I want.: Why does::
$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;: Not become true when
$body contains:: Library Card: 0240742
Probably b
Title: RE: regex expression to determine if i have a valid email!!
There is also the address checking _expression_ in the very nice Mail-Sendmail module.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, September 16
S CTR; 'perl-win32-users'
> Subject: RE: regex expression to determine if i have a valid email!!
>
> so mark...
>
> what you're saying is that i should write a simple perl app
> that does the
> email validation, and call it from the php app, passing it
S CTR
Sent: Friday, September 16, 2005 5:49 AM
To: '[EMAIL PROTECTED]'; 'perl-win32-users'
Subject: RE: regex expression to determine if i have a valid email!!
> i've got a php app
Say it isn't so! :)
> i finally figured that someone here, might have the exa
On 9/16/05, Chris Wagner <[EMAIL PROTECTED]> wrote:
Well it very much depends on what u consider a "valid" email address.Because technically, anything can be valid in some context. What u probablywant here is a fully qualified Internet mail address. The basic form of
this would be m/[EMAIL PROTEC
> i've got a php app
Say it isn't so! :)
> i finally figured that someone here, might have the exact
> soln to my prob!
1. Make sure it is formatted correctly, as per RFC 822. To do that, there is
one big scary regex created by Jeffrey Friedl (author of Mastering Regular
Expressions). If you ch
Chris Wagner wrote:
> Well it very much depends on what u consider a "valid" email address.
> Because technically, anything can be valid in some context. What u probably
> want here is a fully qualified Internet mail address. The basic form of
> this would be m/[EMAIL PROTECTED]/.
The protocol
bruce wrote:
> hi...
>
> i've got a php app, and i'm trying to figure out how/where to turn to to get
> a good working regex in order to determine if i have a valid email address
>
> any help/thoughts/etc.. would be seriously helpful...
>
> i've come across a great many preg_match functions for
Well it very much depends on what u consider a "valid" email address.
Because technically, anything can be valid in some context. What u probably
want here is a fully qualified Internet mail address. The basic form of
this would be m/[EMAIL PROTECTED]/. If u want to limit that to known
"legitima
bruce <> wrote:
: i've got a php app, and i'm trying to figure out how/where to
: turn to to get a good working regex in order to determine if i
: have a valid email address
:
: any help/thoughts/etc.. would be seriously helpful...
:
: i've come across a great many preg_match functions for php,
> >Problem
> >
> >If the string does not contain a trailing \ then add one.
>
> $string .= "\\" unless $string =~ /\\$/;
> or, if you prefer,
> $string .= "\\" if $string !~ /\\$/;
Or
$string =~ s{\\?$}{\\};
--
Mark Thomas
Internet Systems Architect
___
BAE
On Sun, 28 Aug 2005 12:05:07 -0700, you wrote:
>Newbie to RegEx so though I would start with something really easy. My big
>mistake
>
>
>
>Problem
>
>If the string does not contain a trailing \ then add one.
$string .= "\\" unless $string =~ /\\$/;
or, if you prefer,
$string .= "\\" if $string
[EMAIL PROTECTED] wrote:
> Im trying to sort out why the last line in the routine tokenizer()
> fails to strip off the trailing double quote for all but the last
> token.
>
> AFAICT, none of the tokens have any newlines - so I'm at a loss as to
> why it does not do what is expected - (this functi
Jim Hansen wrote:
> Sorry. Lousy explanation. I have a string that will have
> PSserver01...02, etc. I need to check for this string:
>
> $Printserver = "HP4000 [PSserver01]"
>
> I guess this can be as simple as
>
> $Printserver = "HP4000 [PSserver01]"
>
> if ( ! /PSserver/ ) {
Jim Hansen wrote:
> THat's not doing it either. For some reason, when it
> is compiled, that line is ignored.
>
sorry, i missed the part where you said it was working as a script, but
not as a compiled executable.
I don't use the ActiveState compiler, and don't know why that would be
happeni
THat's not doing it either. For some reason, when it
is compiled, that line is ignored.
--- Robert Johnson <[EMAIL PROTECTED]> wrote:
> Jim Hansen wrote:
> >
> > $name = 'HP4000 [PSserver01]';
> > if ( $name =~ /[PSserver/ ) {
> > next;
> > }
> > running this straight as a script with the '-d'
Jim Hansen wrote:
>
> $name = 'HP4000 [PSserver01]';
> if ( $name =~ /[PSserver/ ) {
> next;
> }
> running this straight as a script with the '-d' switch
> or without, it works fine, but if I compile it and run
> it, for some reason it is ignored and I end up with my
> issue. IS there a better wa
Thanks for all the great ideas. What I decided to do
was just check for '[PSserver' because this part is
causing me issues and it isn't needed.
In my script I have writtern as such. I would like to
split the two apart, but can just do a next and ignore
it for now.
$name = 'HP4000 [PSserver01]';
Jim Hansen wrote:
>
> Sorry. Lousy explanation. I have a string that will have
> PSserver01...02, etc. I need to check for this string:
>
> $Printserver = "HP4000 [PSserver01]"
>
> I guess this can be as simple as
>
> $Printserver = "HP4000 [PSserver01]"
> if ( ! /PSserver/ ) {
> do
> }
Sorry. Lousy explanation. I have a string that will have PSserver01...02, etc. I need to check for this string:
$Printserver = "HP4000 [PSserver01]"
I guess this can be as simple as
$Printserver = "HP4000 [PSserver01]"
if ( ! /PSserver/ ) {
do
}
Thanks
$Bill Luebkert <[EMAIL PROTECTED]> w
You do not say what you want to do with
the line or the value for which you are searching. You also do specify if “xx”
is only numeric or not. But anyway…
if ($String =~ /PSserver../){
#do something…
}
if ($String =~ /PSserver\d\d/){
#do something…
}
You should checkout
Jim Hansen wrote:
> I need to parse a string with a specific phrase within it.
>
> For example:
>
> "PSserverxx"
>
> What is the best way to do this?
Insufficient explanation. What do you mean by parse ? Are you trying
to see if that substr is in the string or what ? Show examples of wha
I broke it with brackets, parenthetically speaking.
Thanks all - simple mind making a simple mistake.
-Original Message-
From: Peter Eisengrein [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 5:05 PM
To: 'Perl-Win32-Users Mailing List (E-mail)'
Subject: RE: regex
On Mon, 21 Feb 2005, Peter Eisengrein wrote:
> sorry about that. a bit too quick on the trigger finger. I have the
> following:
>
> @files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" } readdir(DIR);
>
> There are other files in $dir that start with ccs but I only want ccs_cas
> ccs_pri or ccs
Peter Eisengrein <[EMAIL PROTECTED]> wrote:
> sorry about that. a bit too quick on the trigger finger. I have the
following:
No problem. A little fat-fingering happens now and then.
> @files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" } readdir(DIR);
>
> There are other files in $dir that sta
Try changing the square brackets to
parentheses.
-Original Message-
From: Peter Eisengrein
[mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005
4:05 PM
To: 'Perl-Win32-Users Mailing List
(E-mail)'
Subject: RE: regex confusion...
sorry about that. a bit to
sorry about that. a bit too quick on the trigger finger. I have the
following:
@files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" }
readdir(DIR);
There are other files in $dir that start with ccs but I only want ccs_cas
ccs_pri or ccs_atsm but for some reason it seems to also match a fi
Sent: Thursday, January 27, 2005 11:50
To: [EMAIL PROTECTED]
Cc: Dirk Bremer; perl-win32-users@listserv.ActiveState.com;
[EMAIL PROTECTED]
Subject: RE: Regex Help
The reason that "200412" matches in your first regex is that the first
four characters match the pattern (as expected) but ther
To: <[EMAIL PROTECTED]>,
cc:
Subject: RE: Regex Help
Dirk,
I'm not a regex pro, but this worked for me: /^\d{4}(-\d{2}){0,2}$/
I tested it with this:
@test = qw( 2004 200412 20041201 2004-12 2004-12-01 );
foreach $test (@test) {
Title: RE: Regex Help
Okay, this is amazingly cloddish, but it does work and may point out where some of your regexes are going wrong. Whenever I have difficulty, I try to simplify it down and then analyze.
@strings = qw/ 2004 200412 20041201 2004-12 2004-12-01/;
for (@strings){
if
Dirk,
I'm not a regex pro, but this worked for me: /^\d{4}(-\d{2}){0,2}$/
I tested it with this:
@test = qw( 2004 200412 20041201 2004-12 2004-12-01 );
foreach $test (@test) {
print "$test : " . ($test =~ /^\d{4}(-\d{2}){0,2}$/ ? "TRUE" : "FALSE")
. "\n";
}
Regards,
Mike
-O
[EMAIL PROTECTED] <> wrote:
: I wrote a RegEx to let me know if a line of text has exactly
: 36 commas in it (the comma is the separator) and I came up
: with this. I don't think it is quite right. I could use a
: little pointing in the right direction. Any thoughts?
You could use tr/// to co
Any thoughts?
> >
> >
> >$lines[0] =~/^(.*?,){36}.*?$/
>
>
> $lines[0] =~ /^[^,](?:*,[^,]*){36}$/
I like Joe's answer, but if you must use a regex this one works:
print scalar(my @commas = $lines[0] =~ /(,)/g);
- Mark.
___
Perl-Win32-Users mailing l
There's a fun little idiom using tr/// to count the number of
occurances of a character in a string:
perl -le '$str = "a,b,c,d,e"; $count = ($str =~ tr/,/,/); print "$count"'
will output "4", the number of commas in "a,b,c,d,e".
--Kester
> Jeff Williams wrote, on Tue 12/14/2004 11:23
> :
at 09:23 AM 12/14/2004, Jeff Williams wrote:
I wrote a RegEx to let me know if a line of text has exactly 36 commas in
it (the comma is the separator) and I came up with this. I don't think it
is quite right. I could use a little pointing in the right direction. Any
thoughts?
$lines[0] =~/^(.*?,){3
Title: RegEx help
Jeff Williams wrote, on Tue 12/14/2004
11:23: I wrote a RegEx to let me know if a line of text
has exactly 36 commas init (the comma is the separator) and I came up with
this. I don't think itis quite right. I could use a little pointing in the
right direction. Anythough
Joseph Discenza graced perl with these words of wisdom:
> I haven't seen anyone recommend this: /T.*T/i to match two 'T's. I'm not
> going to compare this to $Bill's word-matching routine :).
That's such a simple solution, and it seems to work. In a previous post,
I wrote:
> As an example, sup
Ted Schuerzinger wrote, on Saturday, November 06, 2004 3:29 PM
: I'm an avid, but not very good, Scrabble player. Last night, I was
: playing, and suffered a major brain cramp when I got a rack
: of four vowels
: *and* two blanks: AEIUR**. I couldn't come up with anything
: at the time
$Bill Luebkert graced perl with these words of wisdom:
> Outer:
Hmm I don't understand what the lines "Outer:" and "next Outer;" do.
> while () {
> if (/^[a-z]{7}$/i) {
>
> my $word = $_;
> foreach (qw(a e r s t t t)) {
>if (not $word =~ s/$_//i) {
Glenn Linderman graced perl with these words of wisdom:
> Maybe Ted doesn't care about the performance of repeated similar
> queries. Depends on if he's "cheating in real time", or just
> occasionally wants to check a word. But he did mention the word
> "efficient" in the original posting.
N
Glenn Linderman wrote:
> It looks like you're assuming the 8th letter must be at the beginning or
> end of the 7 letters on the rack. However, depending on the open space
> on the board, the 8th letter (already on the board) could really be
> placed at any position in the resulting 8 letter wo
Glenn Linderman wrote:
> On approximately 11/6/2004 8:48 PM, came the following characters from
> the keyboard of $Bill Luebkert:
>
>>Glenn Linderman wrote:
>>
>>
>>
>>>Let's say you had AERSTTT in your rack (yep, that's the thing that
>>>holds the tiles). Now, clearly that matches the wor
Ted Schuerzinger wrote:
> $Bill Luebkert graced perl with these words of wisdom:
>
>
>>Ted Schuerzinger wrote:
>>
>>
>>>I'm an avid, but not very good, Scrabble player. Last night, I was
>>>playing, and suffered a major brain cramp when I got a rack of four
>>>vowels *and* two blanks: AEIUR*
Glenn Linderman wrote:
> Let's say you had AERSTTT in your rack (yep, that's the thing that
> holds the tiles). Now, clearly that matches the word "tatters". But
> how would you make the regex that finds it, but doesn't find "batters",
> "matters", "hatters", "patters", and even "praters"
$Bill Luebkert graced perl with these words of wisdom:
> Ted Schuerzinger wrote:
>
>> I'm an avid, but not very good, Scrabble player. Last night, I was
>> playing, and suffered a major brain cramp when I got a rack of four
>> vowels *and* two blanks: AEIUR**. I couldn't come up with anythin
Ted Schuerzinger wrote:
> I'm an avid, but not very good, Scrabble player. Last night, I was
> playing, and suffered a major brain cramp when I got a rack of four vowels
> *and* two blanks: AEIUR**. I couldn't come up with anything at the time,
> so this morning wrote a simple Perl script
On Fri, 5 Nov 2004, Beckett Richard-qswi266 wrote:
> use strict;
> use warnings;
> my $pat = "abcdijklmnopuvwxyz";
> print "\$pat is $pat\n";
> $pat =~ /<(.*)>.*<(.*)>/;
> my ($one, $two) = ($1, $2);
> print "\$one is $one\n\$two is $two\n";
That does work in this case, but it's not terribly robus
Beckett Richard-qswi266 wrote:
> use strict;
> use warnings;
> my $pat = "abcdijklmnopuvwxyz";
> print "\$pat is $pat\n";
> $pat =~ /<(.*)>.*<(.*)>/;
You probably want to either make that non-greedy or use a different
expression in case there are more <> in the string :
/<(.*?)>.*<(.*?)>
use strict;
use warnings;
my $pat = "abcdijklmnopuvwxyz";
print "\$pat is $pat\n";
$pat =~ /<(.*)>.*<(.*)>/;
my ($one, $two) = ($1, $2);
print "\$one is $one\n\$two is $two\n";
R.
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Jutu Subramanian,
$Bill wrote:
> ... and \1 is deprecated for $1.
I believe that should read [thanks Greg!] "...and \1 is deprecated on the
right
side of s///". On the left side (as in any regexp), \1 and $1 differ. But
as a holdover from sed, \1 means the same as
$1 on the right side of the subst.
\1 isn't the
Ganesh Babu Nallamothu, Integra-India wrote:
> Hi,
>
> Your Find patter is wrong.
> Use the following Pattern:
>
> s/([\t]\d{2}[:]\d{2}[\s])/\1/;
\t, \s and : do not need to be in a character class and \1 is deprecated for $1.
This should be equivalent:
s/(\t\d{2}:\d{2}\s)/$1/;
You s
Hi,
Your Find patter is wrong.
Use the following Pattern:
s/([\t]\d{2}[:]\d{2}[\s])/\1/;
Regards,
Gopal.R
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Malcolm Mill
Sent: Wednesday, November 03, 2004 2:41 AM
To: [EMAIL PROTECTED]
Subject: regex help
Ne
Title: RE: regex help
Assuming your dates are always in the same format, this would work:
print "$1\n" while ($_ =~ /(\d{1,2}\:\d{2} [ap]m)/gi);
-Pete
> -Original Message-
> From: Malcolm Mill [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 02, 2004 4
Steven Manross graced perl with these words of wisdom:
> R U sure it's not the while loop.. I've never seen that incantation
> b4.. But that's not surprising.. I'm not the most traveled perler..
That while loop is how you process a file line by line.
--
Ted Schuerzinger
The way I see it, y
hey all,
Scratchin' my head on this one for a couple of hours now, looking at camels. sheep and
other documentation creatures to no avail. I'm trying to match a pattern that's
already (must be) in a variable like so:
$var = "coyote";
while () {
if ($_ =~ /$var/i) {
print $_ . " matches\
At 04:58 PM 3/3/2004, Moulder, Glen wrote:
hey all,
Scratchin' my head on this one for a couple of hours now, looking at
camels. sheep and other documentation creatures to no avail. I'm trying
to match a pattern that's already (must be) in a variable like so:
$var = "coyote";
while () {
if (
That works (with the for loop instead of the while)...
@vars = ("coyote","fish","Wile E. Coyote");
$var = "coyote";
#foreach () {
foreach (@vars) {
if ($_ =~ /$var/i) {
print $_ . " matches\n";
};
}
Outputs:
coyote matches
Wile E. Coyote matches
R U sure it's not the while loop.. I'v
Works fine here - 'course the '.' in Wile E. is going to match any char
so:
Wile E. Coyote
matches
Wile Ej Coyote
matches
Wile E. Coyotexxx
matches
using quotemeta or \Q:
#my $var = "coyote";
my $var = quotemeta "Wile E. Coyote";
while () {
if ( /$var/oi) {
print $_ . " matches\n";
}
Jamie Murray wrote:
> Hi Glenn,
> I have worked on this further and looked at some of the previous posts.
> I have tried this with all different combinations of ip address and this has
> worked.
> Of course I got the idea from a previous post from Alex and Mark Thomas.
> Please understand I could
ced clarity.
Happy learning.
- Original Message - From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Jamie Murray" <[EMAIL PROTECTED]>
Cc: "$Bill Luebkert" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 6:24 PM
Subjec
Thanks for the discussion,clear explanation and advice Glenn.
- Original Message -
From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Jamie Murray" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, January 14, 2004 12:48 AM
Subject: Re:
t removes the complex redundancy, and can be expressed
in half the lines even with the enhanced clarity.
Happy learning.
- Original Message -
From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Jamie Murray" <[EMAIL PROTECTED]>
Cc: "$Bill Luebkert" &
.$octet\.$octet\.$octet$/o;
print "yes" if $ip =~ $valid_ip;
- Original Message -
From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Jamie Murray" <[EMAIL PROTECTED]>
Cc: "$Bill Luebkert" <[EMAIL PROTECTED]>;
<[EMAIL PROTECT
;
<[EMAIL PROTECTED]>
Sent: Tuesday, January 13, 2004 9:40 AM
Subject: Re: REGEX help!
BiLL,
If you check my second post I made the correction but I'm still correct in
my example and method.
Actually the e-mail from Raul Davletshin pretty much verifys what I had
also stated and he
1 - 100 of 198 matches
Mail list logo