radhika wrote:
Hi,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
I guess it should have been =~ instead of =
{
print("Hour:Minute = $4:$5\n");
}
if ( $string =~ /.*\s+(\d\d):(\d\
radhika wrote:
> Hi,
> I need to parse this string: 2005-03-11 13:49:41.19
> to just get the hour and minute.
>
> my program has:
>
> if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
> {
>print("Hour:Minute = $4:$5\n");
> }
I doubt that you are running under strict and
> if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
> {
>print("Hour:Minute = $4:$5\n");
> }
>
You have an unmatched [ in your expression.
(\w+) doesn't match the "." if that matters to you.
> This is breaking. If anyone can refine this, that would be great.
> thanks,
> rad
radhika wrote:
Hi,
Hello,
I need to parse this string: 2005-03-11 13:49:41.19
to just get the hour and minute.
my program has:
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ )
{
print("Hour:Minute = $4:$5\n");
}
This is breaking. If anyone can refine this, that would be great.
tha
Abhishek Dave schreef:
Hello ,
i am sticking with a problem to replace all words of a file in such a =
manner that the first and second word need to interchanged.
some thing like ...
10 11 2 20001
so that the output file will be
11 1 20001 2
any helpful regex ??
On Mar 28, Abhishek Dave said:
i am sticking with a problem to replace all words of a file in such a =
manner that the first and second word need to interchanged.
some thing like ...
10 11 2 20001
so that the output file will be
11 1 20001 2
The easiest way I can t
Ing. Branislav Gerzo schreef:
> I need small regexp help, I'm doing webpage, where I rewrite all links
> in XML according weblang parameter.
#!/usr/bin/perl
use strict;
use warnings;
{
local ($,,$\) = ("\t", "\n");
my $orig = "
Foo and Bars Link='http://example.com/' Foo and Bars
Foo and B
Dr.Ruud [DR], on Friday, December 9, 2005 at 12:45 (+0100) wrote:
DR> #!/usr/bin/perl
thanks a lot Dr.Ruud (not Dr.Perl?:)). It works like a charm.
I completely forget to [^morecharacters] idiom.
--
How do you protect mail on web? I use http://www.2pu.net
[I am Ryu of Borg: The pronunciation
Ing. Branislav Gerzo schreef:
> Dr.Ruud:
> thanks a lot Dr.Ruud (not Dr.Perl?:)). It works like a charm.
> I completely forget to [^morecharacters] idiom.
Your welcome. Some of my assumptions may proof to be not practible, but
I think the code is easy to adjust.
Know that there are better ways to
Marcelo wrote:
Which regular expression would you use to remove the and from a line like this one:
Here goes a webpage's title
Thanks a lot in advance.
Try something like:
s/<\/?title>//
Although, I can remember if < and > are special regex characters so you might need to
escape them (\< and
On Sat, 24 Jan 2004, Marcelo wrote:
> Which regular expression would you use to remove the and
> from a line like this one:
>
> Here goes a webpage's title
>
> Thanks a lot in advance.
>
Did you what that _exact_ input? I.e. always ...? If so,
that's rather easy.
$line =~ s/(.*)<\/title>
John McKown wrote:
>On Sat, 24 Jan 2004, Marcelo wrote:
>
>> Which regular expression would you use to remove the and
>> from a line like this one:
>>
>> Here goes a webpage's title
>>
>> Thanks a lot in advance.
>>
>
>Did you what that _exact_ input? I.e. always ...? If so,
>that's rather
You can use a module File::Basename or I use for my scripts a simple
one to extract the filename of my scripts to use in displays(Basic
assumption is a valid filename being searched):
my $MyFilename ;
if ( /^.+[\\\/](.+)/ ) { # assuming full or partial filename is in
$_
On 10 May 2004, at 17:42, <[EMAIL PROTECTED]> wrote:
Well need your help in framing a RegExp
I've to parse for the tag in a HTML/ASP file and then when i
get that i need
to get only yhe action filepath in to an array ! How do i do it ?
Parse::HTML would suggest itself rather then a regex.
F
Jason Price wrote:
I'm trying to write a regular expression to divide up a line of
text into a hash, but am having a hard time with it. I'm hoping
you all can help me.
Here's an example line of text:
Not every line will have the same keys, or the same number of keys.
In that case the example you
Price, Jason (TLR Corp) wrote:
I'm trying to write a regular expression to divide up a line of text
into a hash, but am having a hard time with it. I'm hoping you all can
help me.
Here's an example line of text:
"( uiwgAttribute-OID NAME 'uiwgAttribute' DESC 'Contains meta data about
an attribute
Original Message
From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 24, 2004 3:46 PM
To: [EMAIL PROTECTED]
Subject: Re: RegExp help
> Jason Price wrote:
>> I'm trying to write a regular expression to divide up a line of text
>> into a hash, but a
On Jun 24, Price, Jason (TLR Corp) said:
>"( uiwgAttribute-OID NAME 'uiwgAttribute' DESC 'Contains meta data about
>an attribute' SUP top MUST cn MAY ( uiwgADsType $ uiwgDescription $
>uiwgDisplayName $ uiwgIsMultiValued ) )"
> NAME -> 'uiwgAttribute',
> DESC -> 'Contains meta data ab
On 6/24/2004 4:58 PM, Price, Jason (TLR Corp) wrote:
Original Message
From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 24, 2004 3:46 PM
To: [EMAIL PROTECTED]
Subject: Re: RegExp help
Jason Price wrote:
I'm trying to write a regular expression to divide up a li
Jason Price wrote:
Gunnar Hjalmarsson wrote:
Jason Price wrote:
Not every line will have the same keys, or the same number of
keys.
In that case the example you posted is obviously not sufficient
as a problem description.
Basically, every line will follow a similar pattern: "junk KEY1
value1 KEY2
Lightning flashed, thunder crashed and "Kyrytow, Stefan" <[EMAIL PROTECTED]
m> whispered:
| Example.
| I am writing a script to parse a web log and report on all the hosts in the
| log.
| However I have a command line option to exclude a domain from the report.
| My problem is that I can't figure
from your small code sample everything checks out.
I would be inclined to ensure that the parameter is being read in correctly
with no trailing spaces or strange characters.
If you need more help send a bigger code sample for us to peruse.
-
Craig Moynes
[
On Thursday 13 December 2001 16:36, Ryan Guy wrote:
> just a simple question. I am new to the whole RegExp thing. It gets kind
> of confusing. If someone could point me in the direction of a good
> tutorial with plenty of examples or if someone could post a few regexp with
> small code snippets
To: Jon Shoberg; Beginners (E-mail)
Cc: *MySQL mail list
Subject: RE: Regexp Help !!!
> -Original Message-
> From: Jon Shoberg [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 13, 2002 4:47 PM
> To: Beginners (E-mail)
> Cc: *MySQL mail list; Jon Shoberg
> Su
; "Beginners
(E-mail)" <[EMAIL PROTECTED]>
Cc: "*MySQL mail list" <[EMAIL PROTECTED]>
Sent: Sunday, January 13, 2002 11:36 AM
Subject: RE: Regexp Help !!!
>
> Thanks !
>
> Glad I asked for some other thoughts on this. I totally over looked this
>
Jon Shoberg wrote:
>
> I have a list/database of words that follows as ...
>
> Top
> ...
> Top/Arts/Food
> Top/Arts/Food/Country
> ...
> Top/World/America
> Top/World/Japan
> Top/World/Japan/Economy
> Top/World/Japan/Food
> Top/World/Japan/Food/Country
> Top/World/Japan/Food/Country/By_C
On Mon, Feb 18, 2002 at 01:30:01PM +0100, Jorge Goncalvez wrote:
> Hi, I need some help to have a regexp which could replace : by - in this code:
my $mac=$_Globals{MAC_ADDRESS};
$mac=~s/:/-/g; # Here's the RE you were asking for
my $cmd="arp -s $ipadress $mac";
sys
On Mon, Feb 18, 2002 at 01:30:01PM +0100, Jorge Goncalvez wrote:
>> Hi, I need some help to have a regexp which could replace : by - in this
code:
> my $mac=$_Globals{MAC_ADDRESS};
$mac=~s/://; # You will need to add this to remove the leading colon
> $mac=~s/:/-/g; # Here's
Jorge Goncalvez wrote:
>
> Hi, I need some help to have a regexp which could replace : by - in this code:
>
> my $cmd="arp -s $ipadress $_Globals{MAC_ADDRESS}";
>
> system($cmd);
> actually
> $_Globals{MAC_ADDRESS} is formatted like this :XX:XX:XX:XX:XX:XX and i wanted to
> put it like this: X
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\+:]+)
> (sq|hy|ay|bs|bg|hr|cs|da|nl|
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 matc
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)
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 =
'^\s*(?:(\d+)\s+)?(\w+(?:\s+\w+)*?)(?:\s+((?:sq|hy|ay|bs|bg|hr|cs|da|nl|en|et|fi|fr|de|gr|he|hu|zh|it|ja|kk|lv|pl|pt|pb|ro|ru|sr|sk|sl|es|sv|th|tr|uk|al)(?:\s*,
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.
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|
en|et|fi|fr|de|gr|he|hu|zh|it|ja|kk|lv|pl|pt|pb|ro|ru|
"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 war
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: [EMAI
got it. I only need one set of () and only |.
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 20, 2002 9:30 AM
> To: 'Perl'
> Subject: REGEXP help asap :)
> Importance: High
>
>
> I have a 23,000 accounting error I have to find before 12
> wh
> Here our two reg expr. The first returns all the data I need
> except data
> that starts "~MISC~".
>
> if (/\s+(\w{4,4}00).+\s+([\d,.]+)/){ # $1 = /\w\w\w\w00
> if (/\s+((\w{4,4}00)||~MISC~)).+\s+([\d,.]+)/){ # same
> expression but
> I need it to match if its \w\w\w\w00 or ~MISC~
Well I
Hello Daryl,
Saturday, January 05, 2002, Daryl J. Hoyt <[EMAIL PROTECTED]> wrote:
DJH> Hi,
DJH> I am trying to use the net::telnet module, and I keep timing out. I
DJH> believe it is because I do not have the right prompt. My prompt looks like
DJH> [sqa1@duke:~]$. I do not know why this d
William M West wrote:
>
> David Dorward wrote:
> >
> >(my $action) = ($html =~ /action=\"(.*?)\"/);
> >
> >That gives the same as my example.
>
> using parentheses to capture matches is really neat :) i
> did not know that you could do that.
It is not the parentheses per se that capture matche
43 matches
Mail list logo