CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Post deleted by leorob

 



leorob
Novice

Oct 19, 2011, 7:28 AM

Post #1 of 8 (7224 views)
Post deleted by leorob

 


rovf
Veteran

Oct 20, 2011, 8:21 AM

Post #2 of 8 (7209 views)
Re: [leorob] extract substrings [In reply to] Can't Post

Write a regexp describe your string. Use parenthesis inside your string to capture the parts you are interested in. Use special variables $1, $2 etc. to refer to the captured substring.


wickedxter
User

Oct 22, 2011, 9:38 AM

Post #3 of 8 (7161 views)
Re: [leorob] extract substrings [In reply to] Can't Post

is this being read from a file or is it all in a single variable?


Code
  

my $string =~ /Trap\s\((\d+)\)/m;

print $1;

my $string2 =~ /cmgTrapLocation\.\d\s\=\sSTRING\:\s"(.+)"\s/m;

print $1;



try this


leorob
Novice

Oct 23, 2011, 11:24 PM

Post #4 of 8 (7008 views)
Post deleted by leorob [In reply to]

 


leorob
Novice

Oct 23, 2011, 11:24 PM

Post #5 of 8 (7007 views)
Post deleted by leorob [In reply to]

 


leorob
Novice

Oct 25, 2011, 11:38 PM

Post #6 of 8 (6794 views)
Post deleted by leorob [In reply to]

 


leorob
Novice

Oct 25, 2011, 11:58 PM

Post #7 of 8 (6792 views)
Post deleted by leorob [In reply to]

 


wickedxter
User

Oct 27, 2011, 3:58 AM

Post #8 of 8 (6701 views)
Re: [leorob] extract substrings [In reply to] Can't Post

have you tried this with any luck? post any errors or unxepectied results.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives