Terry,
Something like this should work. Note this is not tested. Here's a
little explanation too. The '.' matches any character as you know and
the '*' says any number of those any characters. The key is the '?'
after the '*' which makes the match "non-greedy". Normally the '*'
matches as
Your expression is expecting following patterns
1) 3 or more digits
OR
2) digit/s comma digit/s
First tow values fit is none of the above-mentioned criteria and hence those
are failing.
Thanks & Regards,
Sandeep Deshpande
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED
I changed your regular expression to this and it worked:
$value =~ /^[0-9]+$|^[0-9][0-9,]*[0-9]$/
Matt Schneider
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, June 10, 2005 12:35 PM
To: perl-unix-users@listserv.A
praveen vejandla wrote:
> hi all,
>
> is it possible to replace all special characters in a string with their
> hex codes using regular expressions.?
Something like:
s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'() ])/sprintf("%02X",ord($1))/eg;
You can use groups of chars like \x00-\x1f and \x7f-\xff in
Well, I'm not sure what you mean by "anything upto a tilda", but you can
write 1 regex to do what you want:
$ more test.pl
#!/usr/bin/perl
$line = '(^FLJK asdf435jk~@!#$';
print "LINE (before): $line\n";
$line =~ s/[^\w\s~]//g;
print "LINE (after): $line\n";
$ perl test.pl
LINE (before): (^FL
Craig Sharp wrote:
> Hi all,
>
>
>
> I have a file with lines that are in the following format:
>
>
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
>
>
> I need to do a substitution so that the line appears as:
>
>
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
>
>
>
> Not
--- Craig Sharp <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a file with lines that are in the following
> format:
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
> I need to do a substitution so that the line appears
> as:
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
Another
Well, looking at the pattern, it looks like you need to start your
substitution when the pattern matches 'bNN' and ends when it hits an IP
address, matching 'NN\.' or 'NNN\.'.
So, here's some (baby-talk ;)) code:
#!/usr/bin/perl
$line = "20011219 074645 b03 3524 switch 10.3.xxx.xxx 3";
# brea
Hi,
>
> ABc Sun May 20 19:45:30, 2001 XYZ
>
if you know the exact string your looking for, you can use
substr:
substr($string, "find_me", lenght_of_find_me) = "find_meD";
Regards,
Christian
--
Christian Schneider
[EMAIL PROTECTED]
Dan Jablonsky wrote:
>
> Hi all,
> I remember reading (probably in the Camel book) that
> the more $1, $2 and so on you have in a regex the
> slower the regex will be executed. It seems any
> backreference is taxing performance considerably.
>
> Is there an alternative? What I am trying to do is
-start-
> Grant Hopwood
>at06/13/2001 01:37 PM
>-start-
PS:
># Concatenation should generally always be faster than substitution which
kind of 'slices, dices, and stretches'
># a string.
That is, faster when replacing almost all of the string.
Grant Hopwood.
Valero Energy Corp.
(210)37
-start-
> Dan Jablonsky <[EMAIL PROTECTED]>
>at06/13/2001 12:22 PM
>Is there an alternative? What I am trying to do is
>isolate some patterns with each line of a text file
>and then make small changes to those pieces and/or
>switching the position of some of those pieces. Is it
>possible to
12 matches
Mail list logo