Re: Regular Expression Help.

2015-03-25 Thread Shlomi Fish
Hi Frank, On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino vinofra...@gmail.com wrote: Hi Team, How to understand Regular Expression in a easy way? This page has links to some recommended tutorials about learning regular expressions: http://perl-begin.org/topics/regular-expressions/

Re: Regular Expression Help.

2015-03-25 Thread Simon Reinhardt
Hi Frank, when first learning regexps I read the section In the World of Regular Expressions in the Lama-Book [1]. If you find this introduction to slow, you might also take a look at chromatic's Modern Perl, which is available for free [2]. Regards, Simon Am

Re: Regular Expression Help.

2015-03-25 Thread Shawn H Corey
On Wed, 25 Mar 2015 10:31:40 +0530 Frank Vino vinofra...@gmail.com wrote: Hi Team, How to understand Regular Expression in a easy way? Thanks, Frank Sorry Frank but there's no easy way. ☹ Some things to remember: Some punctuation marks have special meaning, like periods, question

Re: Regular Expression Help.

2015-03-25 Thread Frank Vino
Thanks a lot Simon -Frank On Wed, Mar 25, 2015 at 5:44 PM, Simon Reinhardt si...@keinstein.org wrote: Hi Frank, when first learning regexps I read the section In the World of Regular Expressions in the Lama-Book [1]. If you find this introduction to slow, you might also take a look at

Re: Regular Expression Help.

2015-03-24 Thread Rahul Gojame
Frank, Just go through below site, it helps to build regex and test same easily. http://www.regexr.com/ ~Rahul On Wed, Mar 25, 2015 at 10:42 AM, Akshay Mohit akshaymohit2...@gmail.com wrote: Just start using it and you will find it very easy to understand. -Akshay On Wed, Mar 25, 2015 at

Re: Regular Expression Help.

2015-03-24 Thread Akshay Mohit
Just start using it and you will find it very easy to understand. -Akshay On Wed, Mar 25, 2015 at 10:31 AM, Frank Vino vinofra...@gmail.com wrote: Hi Team, How to understand Regular Expression in a easy way? Thanks, Frank

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Uday Vernekar
When i run this script i get following Error bash-4.2$ ./regex.pl feature version v5.16.0 required--this is only version v1.160.0 at ./ regex.pl line 4. BEGIN failed--compilation aborted at ./regex.pl line 4. But I am using perl version as swon below. bash-4.2$ perl -v This is perl 5,

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Jing Yu
On 17 Sep 2014, at 17:08, Uday Vernekar vernekaru...@gmail.com wrote: When i run this script i get following Error bash-4.2$ ./regex.pl feature version v5.16.0 required--this is only version v1.160.0 at ./regex.pl line 4. BEGIN failed--compilation aborted at ./regex.pl line 4. But

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Uday Vernekar
when i change use 5.16.0; to use feature ':5.10'; it works i get following output bash-4.2$ ./regex.pl Use of uninitialized value $3 in say at ./regex.pl line 7, DATA line 1. Use of uninitialized value $4 in say at ./regex.pl line 7, DATA line 1. Video1280x720 Use of uninitialized value $2 in

RE: Re: Regular expression: option match after a greedy/non-greedy match

2014-09-17 Thread Viet-Duc Le
---Original Message--- From: Jing Yu logus...@googlemail.com To: Viet-Duc Le leviet...@kaist.ac.kr Sent date: 2014-09-17 12:20:29 GMT +0900 (Asia/Seoul) Subject: Re: Regular expression: option match after a greedy/non-greedy match Hi Viet-Duc Le, On 17 Sep 2014

Re: Regular expression: option match after a greedy/non-greedy match

2014-09-16 Thread Jing Yu
Hi Viet-Duc Le, On 17 Sep 2014, at 10:23, Viet-Duc Le leviet...@kaist.ac.kr wrote: Greeting from S. Korea ! I am parsing the output of ffmpeg with perl. Particular, I want to print only these lines among the output and capturing the resolution, i.e. 1280x720. Stream #0:0: Video:

RE: regular expression

2014-05-07 Thread Vishal Gupta
Subject: Re: regular expression On 05/07/2014 01:40 AM, John SJ Anderson wrote: my @strings = ( ^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms , ^Modifications made by danwong on 2014/05/06 18:27:48 from database brms², ); foreach my

Re: regular expression

2014-05-06 Thread John SJ Anderson
On Tue, May 6, 2014 at 10:19 PM, Danny Wong (dannwong) dannw...@cisco.com wrote: What is a regular expression where I can extract ³danwong² from either string (one string have () parentheses and the other doesn¹t have parentheses)? I'm not entirely sure what you're trying to accomplish, but

Re: regular expression

2014-05-06 Thread Danny Wong (dannwong)
Both string are possible outputs, so I want to be able to grep for the username only. I tried this, but it works for the string without parentheses. ^Modifications made by danwong on 2014/05/06 18:27:48 from database brms, $str1 =~ /by.*?[(]?(.*?)[)]?\s+on/i; The one with partheses gives me

Re: regular expression

2014-05-06 Thread shawn wilson
On Wed, May 7, 2014 at 1:19 AM, Danny Wong (dannwong) dannw...@cisco.com wrote: Hi Guys, I have the following strings. my $str1=^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms; #$str1=^Modifications made by danwong on 2014/05/06 18:27:48 from

Re: regular expression

2014-05-06 Thread John SJ Anderson
On Tue, May 6, 2014 at 10:30 PM, Danny Wong (dannwong) dannw...@cisco.com wrote: Both string are possible outputs, so I want to be able to grep for the username only. Well, if the username will always be either the only thing between 'by' and 'on', or in parens if it's not... #! /usr/bin/env

Re: regular expression

2014-05-06 Thread Uri Guttman
On 05/07/2014 01:40 AM, John SJ Anderson wrote: my @strings = ( ^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48 from database brms , ^Modifications made by danwong on 2014/05/06 18:27:48 from database brms², ); foreach my $string ( @strings ) { my( $match ) =

Re: Regular expression help pls !

2013-08-23 Thread Gianrossi, Paolo
Not sure I get it, but would /^fc3\/2\b/ (assuming you're looking for fc3/2 and not fc3/23) work? hth paolino On 23 Aug 2013, at 17:06, jet speed speedj...@googlemail.com wrote: Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the

Re: Regular expression help pls !

2013-08-23 Thread Shawn H Corey
On Fri, 23 Aug 2013 17:06:41 +0100 jet speed speedj...@googlemail.com wrote: my @check = (fc3/23, fc10/1, fc3/14, fc12/12); my @check = qw( fc3/23 fc10/1 fc3/14 fc12/12 ); my $f2 = 'out.txt'; for my $element(@check) { open my $fh2, '', $f2 or die could not open $f2: $!; while (my $line =

Re: Regular expression help pls !

2013-08-23 Thread David Precious
On Fri, 23 Aug 2013 17:06:41 +0100 jet speed speedj...@googlemail.com wrote: Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the entries from the array to the file and print the matching line for example if i only want to match

Re: Regular expression help pls !

2013-08-23 Thread Nathan Hilterbrand
See sample code below Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the entries from the array to the file and print the matching line for example if i only want to match fc3/23, in my code it prints both the lines fc3/2 and

Re: Regular expression help pls !

2013-08-23 Thread Jim Gibson
On Aug 23, 2013, at 9:06 AM, jet speed wrote: Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the entries from the array to the file and print the matching line for example if i only want to match fc3/23, in my code it prints both

Re: Regular expression help pls !

2013-08-23 Thread jet speed
Chaps, I am testing all your code one by one, Appreciate your time and detailed inputs. Many Thanks Sj On Fri, Aug 23, 2013 at 6:01 PM, Jim Gibson jimsgib...@gmail.com wrote: On Aug 23, 2013, at 9:06 AM, jet speed wrote: Chaps, Please i need help on the regular expression, i have

Re: regular expression help

2012-09-21 Thread Octavian Rasnita
From: Dr.Ruud rvtol+use...@isolution.nl On 2012-09-20 09:08, Octavian Rasnita wrote: my ( $file_name ) = $data =~ /([^\\]+)$/g; No need for that g-modifier. -- Ruud Yes, you are right. I added it by mistake. Octavian -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: regular expression help

2012-09-20 Thread Octavian Rasnita
From: Irfan Sayed irfan_sayed2...@yahoo.com i have string 'c:\p4\car\abc\xyz.csproj' i just need to match the xyz.csproj i tried few option but does not help. can someone please suggest regards irfan my $data = 'c:\p4\car\abc\xyz.csproj'; my ( $file_name ) = $data =~ /([^\\]+)$/g;

Re: regular expression help

2012-09-20 Thread Irfan Sayed
got it myself :) thanks a lot  $line_to_add =~ m/([a-zA-Z]+\.csproj)/; regards From: Irfan Sayed irfan_sayed2...@yahoo.com To: Perl Beginners beginners@perl.org Sent: Thursday, September 20, 2012 12:07 PM Subject: regular expression help i have string

Re: regular expression help

2012-09-20 Thread Michael Brader
On 09/20/2012 04:39 PM, Irfan Sayed wrote: got it myself :) thanks a lot $line_to_add =~ m/([a-zA-Z]+\.csproj)/; Hi Irfan, Your solution will only match files that consist of ASCII alphabetic characters followed by '.csproj'. It will also match these: *

Re: regular expression help

2012-09-20 Thread Shlomi Fish
On Thu, 20 Sep 2012 17:13:07 +0930 Michael Brader mbra...@internode.com.au wrote: A more idiomatic way to do this is to use the File::Spec module. Inspect the output of this program for inspiration: There's also File::Basename: http://perldoc.perl.org/File/Basename.html Regards,

Re: regular expression help

2012-09-20 Thread Irfan Sayed
thanks a lot for all the responses :) regards From: Shlomi Fish shlo...@shlomifish.org To: Michael Brader mbra...@internode.com.au Cc: beginners@perl.org Sent: Thursday, September 20, 2012 2:53 PM Subject: Re: regular expression help On Thu, 20 Sep 2012

Re: regular expression help

2012-09-20 Thread Dr.Ruud
On 2012-09-20 09:08, Octavian Rasnita wrote: my ( $file_name ) = $data =~ /([^\\]+)$/g; No need for that g-modifier. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Regular Expression change

2011-07-20 Thread Rob Dixon
On 15/07/2011 16:42, David Wagner wrote: I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon in the data. So what I have is a

Re: Regular Expression change

2011-07-17 Thread Dr.Ruud
On 2011-07-15 17:42, Wagner, David --- Sr Programmer Analyst --- CFS wrote: I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon

Re: Regular Expression help!

2011-05-11 Thread Leo Susanto
I ended up confused after reading your email. Please specify INPUT + OUTPUT/condition. You have already specify INPUT which is: LOGICAL UNIT NUMBER 587 UID:60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 LOGICAL UNIT NUMBER 128 UID:

Re: Regular Expression help!

2011-05-11 Thread Shawn H Corey
On 11-05-11 11:38 AM, jet speed wrote: I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find with regulare expression #if ($_=~

Re: Regular Expression help!

2011-05-11 Thread Rob Dixon
On 11/05/2011 16:38, jet speed wrote: Hi All, I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find with regulare expression

Re: Regular Expression help!

2011-05-11 Thread C.DeRykus
On May 11, 8:38 am, speedj...@googlemail.com (jet speed) wrote: Hi All, I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find

Re: Regular Expression help!

2011-05-11 Thread jet speed
Hi All, Thanks for your time and valuable inputs, Appreciate it. I will try your suggestions and test it in my program. Sj

Re: regular expression

2011-04-28 Thread John W. Krahn
Irfan Sayed wrote: hi, Hello, i have following code. $target = abc,xyz; print $target\n; $target =~ s/,/\s/g; print $target\n; i need to replace comma with whitespace for string abc,xyz Whitespace is something that applies only to regular expressions but the second part of the

Re: regular expression

2011-04-28 Thread John W. Krahn
John W. Krahn wrote: Irfan Sayed wrote: i have following code. $target = abc,xyz; print $target\n; $target =~ s/,/\s/g; print $target\n; i need to replace comma with whitespace for string abc,xyz Whitespace is something that applies only to regular expressions but the second part of the

Re: regular expression

2011-04-28 Thread Shawn H Corey
On 11-04-28 10:05 AM, Irfan Sayed wrote: hi, i have following code. $target = abc,xyz; print $target\n; $target =~ s/,/\s/g; print $target\n; i need to replace comma with whitespace for string abc,xyz the output shud be abc xyz the above regular expression does not do that . please

Re: regular expression

2011-04-28 Thread Irfan Sayed
: Thursday, April 28, 2011 7:47 PM Subject: Re: regular expression Irfan Sayed wrote: hi, Hello, i have following code. $target = abc,xyz; print $target\n; $target =~ s/,/\s/g; print $target\n; i need to replace comma with whitespace for string abc,xyz Whitespace is something that applies only

Re: regular expression

2011-04-28 Thread Irfan Sayed
thanks all From: Shawn H Corey shawnhco...@ncf.ca To: beginners@perl.org Sent: Thursday, April 28, 2011 7:55 PM Subject: Re: regular expression On 11-04-28 10:05 AM, Irfan Sayed wrote: hi, i have following code. $target = abc,xyz; print $target\n

Re: regular expression

2011-04-28 Thread Karl Kaufman
- Original Message - From: Irfan Sayed irfan_sayed2...@yahoo.com To: John W. Krahn jwkr...@shaw.ca; Perl Beginners beginners@perl.org Sent: Thursday, April 28, 2011 9:28 AM Subject: Re: regular expression my logic was to just put the space character in place of comma and keep rest

Re: regular expression

2011-04-28 Thread Uri Guttman
KK == Karl Kaufman krk...@comcast.net writes: KK Well, to be precise, your conceptual logic was fine; the KK implementation was flawed. As several have pointed out, you KK weren't replacing the comma with a _space_ *character*, but with KK the RegExp _whitespace_ *character class*. to

Re: Regular expression help !!

2011-04-27 Thread Paolo Gianrossi
2011/4/27 jet speed speedj...@googlemail.com Hi, Please could you advice, how can i write a regular expression for the line below to capture 0079 and 69729260057253303030373 0079 Not Visible 69729260057253303030373 i tried this one, no luck

Re: Regular expression help !!

2011-04-27 Thread Jeff Pang
2011/4/27 jet speed speedj...@googlemail.com: Hi, Please could you advice, how can i write a regular expression for the line below to capture 0079 and 69729260057253303030373 0079 Not Visible             69729260057253303030373 This might help? $ perl -le ' $str=0079 Not

Re: Regular expression help !!

2011-04-27 Thread Rob Dixon
On 27/04/2011 11:47, jet speed wrote: Please could you advice, how can i write a regular expression for the line below to capture 0079 and 69729260057253303030373 0079 Not Visible 69729260057253303030373 i tried this one, no luck /(^\d{4})\s\w+\s\w+\s+\d+/ig)

Re: Regular expression help !!

2011-04-27 Thread jet speed
Hi all, Thanks for all our inputs, The regular expression below works fine if do it for single line, i am trying to caputre the match $1, and $2 into array. only the first line is pushed to the array. what am i doing wrong ? how to get all the $1 and $2 match values for each line into arrary ?

Re: Regular expression help !!

2011-04-27 Thread Jim Gibson
On 4/27/11 Wed Apr 27, 2011 8:32 AM, jet speed speedj...@googlemail.com scribbled: Hi all, Thanks for all our inputs, The regular expression below works fine if do it for single line, i am trying to caputre the match $1, and $2 into array. only the first line is pushed to the array.

Re: Regular expression help !!

2011-04-27 Thread Paul Johnson
On Wed, Apr 27, 2011 at 04:32:57PM +0100, jet speed wrote: Hi all, Thanks for all our inputs, The regular expression below works fine if do it for single line, i am trying to caputre the match $1, and $2 into array. only the first line is pushed to the array. what am i doing wrong ? how

Re: Regular expression help !!

2011-04-27 Thread Shawn H Corey
On 11-04-27 12:47 PM, Jim Gibson wrote: The metasymbol \d matches the characters [0-9], not the extended hexadecimal set that includes A-Z. To match those, construct your own character class: [0-9A-Z] You can use the POSIX xdigit character class instead: #!/usr/bin/env perl use strict; use

Re: Regular expression help !!

2011-04-27 Thread Brian Fraser
On Wed, Apr 27, 2011 at 2:48 PM, Shawn H Corey shawnhco...@ncf.ca wrote: On 11-04-27 12:47 PM, Jim Gibson wrote: The metasymbol \d matches the characters [0-9], not the extended hexadecimal set that includes A-Z. To match those, construct your own character class: [0-9A-Z] You can use

Re: Regular expression help !!

2011-04-27 Thread Dr.Ruud
On 2011-04-27 18:47, Jim Gibson wrote: The metasymbol \d matches the characters [0-9], Beware: the \d matches 250+ code points. So don't use \d if you only mean [0-9]. not the extended hexadecimal set that includes A-Z. To match those, construct your own character class: [0-9A-Z] Or

Re: Regular expression help !!

2011-04-27 Thread jet speed
Excellent Guys, I would like thank each one of you for inputs. Much appreciated. i got blinded by just the numbers 0079, i didn't cater for the next line which is hex 007A, as one of you rightly pointed out [ 0-9A-Z] , does the trick. its amazing to see different technique to achieve the same

Re: Regular expression to capitalize first letter of words in sentence

2011-04-14 Thread John Delacour
At 13:39 +0300 12/04/2011, Shlomit Afgin wrote: I need to write regular expression that will capitalize the first letter of each word in the string. Word should be word that her length is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string);

Re: Regular expression to capitalize first letter of words in sentence

2011-04-14 Thread marcos rebelo
I agree completely with you, clean code is the best documentation. But in your snippet I have to say: The use of $ anywhere in a program imposes a considerable performance penalty on all regular expression matches. it would be better to avoid default/magic variables. I would consider this

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread John W. Krahn
Shlomit Afgin wrote: Hi Hello, I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string); $string =~

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Ramprasad Prasad
On 13 April 2011 11:40, Shlomit Afgin shlomit.af...@weizmann.ac.il wrote: Hi I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'.

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Shlomi Fish
Hi Ramprasad, thanks for your answer, but see below for my comments. On Wednesday 13 Apr 2011 14:30:36 Ramprasad Prasad wrote: On 13 April 2011 11:40, Shlomit Afgin shlomit.af...@weizmann.ac.il wrote: Hi I need to write regular expression that will capitalize the first letter of

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread C.DeRykus
On Apr 12, 11:10 pm, shlomit.af...@weizmann.ac.il (Shlomit Afgin) wrote: Hi   I need to write regular expression that will capitalize the first letter of each word in the string.   Word should be string with length that is greater or equal to 3 letters   exclude the words 'and' and 'the'.

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Rob Dixon
On 13/04/2011 07:10, Shlomit Afgin wrote: I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'. I tried: $string = lc($string);

Re: regular expression for email id and IP address

2011-04-09 Thread Jim Gibson
At 11:42 PM +0530 4/9/11, Sunita Rani Pradhan wrote: Hi All 1. Can anybody guide me to write a regular expression to verify correct Email address ? peldoc -q valid How do I check a valid mail address? 2. I have written a regular expression to verify correct

RE: regular expression for email id and IP address

2011-04-09 Thread Sunita Rani Pradhan
Yes it is matching 167.249.0.0 . -Sunita -Original Message- From: Jim Gibson [mailto:jimsgib...@gmail.com] Sent: Saturday, April 09, 2011 11:50 PM To: Perl Beginners Subject: Re: regular expression for email id and IP address At 11:42 PM +0530 4/9/11, Sunita Rani Pradhan wrote: Hi All

Re: regular expression for email id and IP address

2011-04-09 Thread Brian Fraser
use Regexp::Common qw/ net /; $ip =~ /$RE{net}{IPv4}/;

Re: regular expression for email id and IP address

2011-04-09 Thread Olof Johansson
On 2011-04-09 23:53 +0530, Sunita Rani Pradhan wrote: Yes it is matching 167.249.0.0 . But it's also matching things like 42. Feature? Read about quantifiers, and also about the precedence of |. -- - Olof Johansson - www: http://www.stdlib.se/ - {mail,xmpp}: o...@ethup.se - irc:

RE: regular expression for email id and IP address

2011-04-09 Thread Sunita Rani Pradhan
Hi Johan You are right. Thanks for pointing out . Can you help me getting it correct ? Thanks Sunita -Original Message- From: Olof Johansson [mailto:o...@ethup.se] Sent: Sunday, April 10, 2011 12:13 AM To: beginners@perl.org Subject: Re: regular expression for email id and IP

Re: regular expression for email id and IP address

2011-04-09 Thread Olof Johansson
On 2011-04-10 01:40 +0530, Sunita Rani Pradhan wrote: Hi Johan s/Johan/Olof/, but who keeps score? You are right. Thanks for pointing out . Can you help me getting it correct ? Somebody already mentioned Regex::Common. -- - Olof Johansson - www: http://www.stdlib.se/ -

Re: regular expression for email id and IP address

2011-04-09 Thread Rob Dixon
On 09/04/2011 21:30, Olof Johansson wrote: On 2011-04-10 01:40 +0530, Sunita Rani Pradhan wrote: You are right. Thanks for pointing out. Can you help me getting it correct ? Somebody already mentioned Regex::Common. Use the same module for email addresses: use Regexp::Common qw/ net

Re: Regular expression to delete from a string unseen characters

2011-03-08 Thread Dr.Ruud
On 2011-03-06 17:22, Shlomit Afgin wrote: I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. See perldoc perlre, specifically

Re: Regular expression to delete from a string unseen characters

2011-03-07 Thread terry peng
I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. May you try the dos2unix command? -- To unsubscribe, e-mail:

Re: Regular expression to delete from a string unseen characters

2011-03-07 Thread Rob Dixon
On 06/03/2011 16:22, Shlomit Afgin wrote: I have a data that contain unseen characters that I want to delete. The unseen characters can be ^L, ^N and other sign that I cannot copy but I see them in my data. Is someone know which regular can help me. Hi Shlomit. It would be better to list

Re: regular expression for special html characters

2011-02-03 Thread Jeff Pang
2011/2/2 Shlomit Afgin shlomit.af...@weizmann.ac.il: Hello, I tried to convert html special characters to their real character. For example, converting    #8221;      to       . I had the string $str = #8220; test #8221; ניסיון ; The string contain also Hebrew letters. Could Encode

Re: regular expression for special html characters

2011-02-03 Thread Shawn H Corey
On 11-02-02 04:25 AM, Shlomit Afgin wrote: I tried to convert html special characters to their real character. For example, converting#8221; to. I had the string $str = #8220; test#8221; ניסיון ; The string contain also Hebrew letters. This seems to work: #!/usr/bin/perl use

Re: regular expression for special html characters

2011-02-03 Thread John Delacour
At 18:52 +0800 03/02/2011, Jeff Pang wrote: 2011/2/2 Shlomit Afgin shlomit.af...@weizmann.ac.il: I tried to convert html special characters to their real character. For example, converting    #8221;      to       . I had the string $str = #8220; test #8221; ÈÒÈÂÔ†¢ª The string

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Robert Wohlfarth
On Tue, Nov 2, 2010 at 5:50 AM, Larsen, Henning Engelbrecht h...@risoe.dtu.dk wrote: I want to search a string for patterns but starting the search from the _end_ instead of from the beginning, using a regular expression. Try something like this: $string = ...looong string possibly with

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Jim Gibson
At 11:50 AM +0100 11/2/10, Larsen, Henning Engelbrecht wrote: I want to search a string for patterns but starting the search from the _end_ instead of from the beginning, using a regular expression. Not a regular expression, but if all you are looking for is a substring, use rindex: perldoc

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
Hi Henning, $catch = $1 if ($string =~ /.*(E)\d*\b/); you can use this to test it: $catch = $1 if ($string =~ /.*(E\d*)\b/); -- Regards, Akhthar Parvez K http://www.sysadminguide.com/ UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity -

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Uri Guttman
APK == Akhthar Parvez K akht...@sysadminguide.com writes: APK Hi Henning, APK $catch = $1 if ($string =~ /.*(E)\d*\b/); APK you can use this to test it: APK $catch = $1 if ($string =~ /.*(E\d*)\b/); he didn't say there will be digits at the end. what if there aren't? his example was

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
Hi Uri, On Wednesday 03 Nov 2010, Uri Guttman wrote: APK $catch = $1 if ($string =~ /.*(E)\d*\b/); he didn't say there will be digits at the end. what if there aren't? his example was just random text following the last E. It will match even if there are no digits at the end: input:

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Uri Guttman
APK == Akhthar Parvez K akht...@sysadminguide.com writes: APK Hi Uri, APK On Wednesday 03 Nov 2010, Uri Guttman wrote: APK $catch = $1 if ($string =~ /.*(E)\d*\b/); he didn't say there will be digits at the end. what if there aren't? his example was just random text following

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread Akhthar Parvez K
On Wednesday 03 Nov 2010, Uri Guttman wrote: try: 'E123EEExyz' your \b at the end also breaks many cases. perl -le 'print $1 if (EE123EExyz =~ /.*(E)\d*\b/)' perl -le 'print $1 if (EE123abc =~ /.*(E)\d*\b/)' perl -le 'print $1 if (EE123EExyzE =~ /.*(E)\d*\b/)' E the first two

Re: Regular expression: Search a pattern but starting from the end of a string?

2010-11-02 Thread C.DeRykus
On Nov 2, 3:50 am, h...@risoe.dtu.dk (Larsen, Henning Engelbrecht) wrote: I want to search a string for patterns but starting the search from the _end_ instead of from the beginning, using a regular expression. For instance I want to find the last 'E' in the string ...looong string possibly

Re: Regular expression question

2010-08-14 Thread C.DeRykus
On Aug 13, 1:47 pm, tobias.wage...@googlemail.com (irata) wrote: I want to replace in a javscript structure like the one below every occurence of {#...}, {?...}, {+...} and {=...} through something different (also nested):    function() {       test1 = {#Caption};       test2 = {#Te{?st}};

Re: Regular expression question

2010-08-14 Thread C.DeRykus
On Aug 14, 6:28 am, dery...@gmail.com (C.DeRykus) wrote: On Aug 13, 1:47 pm, tobias.wage...@googlemail.com (irata) wrote: I want to replace in a javscript structure like the one below every occurence of {#...}, {?...}, {+...} and {=...} through something different (also nested):    

Re: Regular expression question

2010-08-13 Thread Jim Gibson
On 8/13/10 Fri Aug 13, 2010 1:47 PM, irata tobias.wage...@googlemail.com scribbled: Hi... I want to replace in a javscript structure like the one below every occurence of {#...}, {?...}, {+...} and {=...} through something different (also nested): Check out the Text::Balanced module,

Re: regular expression - ?(foo.*)?

2010-03-02 Thread raphael()
On Tue, Mar 2, 2010 at 5:45 PM, Durairaj Muthusamy tech.du...@gmail.comwrote: Hi, I am a newbie and need your help. The following script doesn't display the first print statement like the second one. Why? @str = qw(NEW food foosball newstr foobasefoot); $\ = \n; foreach(@str) {

Re: regular expression - ?(foo.*)?

2010-03-02 Thread Johann Markl
Hello Durairaj Muthusamy wrote: I am a newbie and need your help. The following script doesn't display the first print statement like the second one. Why? print First: $ if ?(foo.*)?; print Second: $ if /(foo.*)/; The delimiters for the regular expressions behave slightly

Re: regular expression - ?(foo.*)?

2010-03-02 Thread Durairaj Muthusamy
Thanks very much for clearing my doubts. Regards, Durai On Tue, Mar 2, 2010 at 7:44 PM, Johann Markl johann.ma...@googlemail.com wrote: Hello Durairaj Muthusamy wrote:  I am a newbie and need your help. The following script doesn't display the first print statement like the second one.  

Re: Regular expression help

2009-08-26 Thread Uri Guttman
DT == Dave Tang d.t...@imb.uq.edu.au writes: DT a,b,c,d,e,f1,f2,g1,g2 which spoil my split(/,/). DT Could someone provide some guidance? use a CSV module. parsing csv files is a pain with regexes (even if doable). there are very stable and fast csv modules on cpan so get one and use it.

Re: Regular expression help

2009-08-26 Thread Chas. Owens
On Wed, Aug 26, 2009 at 02:23, Dave Tangd.t...@imb.uq.edu.au wrote: Dear list, I am trying to import entries in a csv file into a relational database, however there are entries such as: a,b,c,d,e,f1,f2,g1,g2 which spoil my split(/,/). snip Sounds like a job for [Text::CSV][1]. Of course,

Re: Regular expression help

2009-08-26 Thread Dave Tang
On Wed, 26 Aug 2009 16:41:39 +1000, Chas. Owens chas.ow...@gmail.com wrote: On Wed, Aug 26, 2009 at 02:23, Dave Tangd.t...@imb.uq.edu.au wrote: Dear list, I am trying to import entries in a csv file into a relational database, however there are entries such as: a,b,c,d,e,f1,f2,g1,g2 which

Re: Regular expression help

2009-08-26 Thread Chas. Owens
On Wed, Aug 26, 2009 at 03:46, Dave Tangd.t...@imb.uq.edu.au wrote: snip for my $token ($line =~ /([,]|[^,]+)/g) { I changed the single pipe (|) to double pipes (||) and $token also contained empty strings. Could you explain the difference between the pipes? snip The pipe character in regexes

RE: regular expression help

2009-06-17 Thread Ajay Kumar
Hi Irfan This code solve your problem my $p=\ProductName\ = \8:EXFO RTU System 1.2.42\; my ($val)=$p=~ m/\d+.\d+.(\d+)\/; my $inval=$val+1; $p=~s/$val/$inval/; print===$p\n; thanks Ajay -Original Message- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, June 17,

Re: regular expression help

2009-06-17 Thread Irfan Sayed
:41 PM Subject: RE: regular expression help Hi Irfan This code solve your problem my $p=\ProductName\ = \8:EXFO RTU System 1.2.42\; my ($val)=$p=~ m/\d+.\d+.(\d+)\/; my $inval=$val+1; $p=~s/$val/$inval/; print===$p\n; thanks Ajay -Original Message- From: Irfan Sayed [mailto:irfan_sayed2

Re: regular expression help

2009-06-17 Thread John W. Krahn
Irfan Sayed wrote: Hi All, Hello, need help on regular expression. i have string like this ProductName = 8:EXFO RTU System 1.2.42 now i want regular expression in such a way that it will change the line to : ProductName = 8:EXFO RTU System 1.2.43 $ perl -le' $_ = q[ProductName =

Re: Regular Expression - exclude character from character class ?

2009-01-09 Thread Mr. Shawn H. Corey
On Thu, 2009-01-08 at 20:25 -0800, howa wrote: Hello, Consider the string: $s = '[[2003]] abc [[2008]] def'; I want to extract 2008 and def, so using \[\[([\w\W^\]]+?)\]\]\s(.+?) The regex match all string, even thought I have added to exclude: ^\] inside the character

Re: Regular Expression - exclude character from character class ?

2009-01-09 Thread Chas. Owens
On Thu, Jan 8, 2009 at 23:25, howa howac...@gmail.com wrote: Hello, Consider the string: $s = '[[2003]] abc [[2008]] def'; I want to extract 2008 and def, so using \[\[([\w\W^\]]+?)\]\]\s(.+?) The regex match all string, even thought I have added to exclude: ^\] inside the character

Re: Regular expression problem

2008-11-19 Thread howa
Hello On Nov 18, 8:18 pm, [EMAIL PROTECTED] (Rob Coops) wrote: If you want to capture both lines you end up doing somehting like this: (.*){0,1}$ Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regular expression problem

2008-11-19 Thread Rob Dixon
Rob Coops wrote: On Tue, Nov 18, 2008 at 9:52 AM, howa [EMAIL PROTECTED] wrote: Hello, I have two strings: 1. abc 2. abc The line of string might end with or not, so I use the expression: (.*)[$] Why it didn't work out? This does not work because $ denotes the end of the

RE: Regular expression problem

2008-11-18 Thread Stewart Anderson
-Original Message- From: howa [mailto:[EMAIL PROTECTED] Sent: 18 November 2008 08:53 To: beginners@perl.org Subject: Regular expression problem Hello, I have two strings: 1. abc 2. abc The line of string might end with or not, so I use the expression: (.*)[$]

  1   2   3   4   5   >