Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 29th, 2008, 07:55 AM
umbrella's Avatar
umbrella umbrella is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 85 umbrella User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 38 m 31 sec
Reputation Power: 5
Pasre sign between quotes

g'day everybody.
I've got few lines, for example
Code:
set = str("\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
set = str("User-Agent: Mozilla/4.0", "(compatible; MSIE 6.0; Windows NT 5.0)");

And I need rexexp value so as to take it from array in perl...
$_[0] =~ s/....../
I just need take value between " "(quotes)
currently I use perl.

Reply With Quote
  #2  
Old December 29th, 2008, 08:26 AM
prometheuzz prometheuzz is offline
User 165270
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 497 prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level)prometheuzz User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 5 Days 10 h 14 m 35 sec
Reputation Power: 936
It is not clear to me what you want to do exactly.
How can your "few lines" look like? The first just has one pair of quotes in it, while the second has two pairs of quotes.
Are you processing the in put line by line or are your two examples stored in one string?
Have you already tried something yourself? If so, could you post that as well: that way you might learn from your mistakes if someone points out the error in your code.

Reply With Quote
  #3  
Old December 29th, 2008, 08:26 AM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 738 OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level)OmegaZero User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 5 m 21 sec
Reputation Power: 928
Using Perl, the easiest way would be to use Text::Balanced (which comes with perl) or Regexp::Common to do the dirty work for you.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
  #4  
Old December 29th, 2008, 08:51 AM
umbrella's Avatar
umbrella umbrella is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 85 umbrella User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 38 m 31 sec
Reputation Power: 5
yes, i use Text::Balanced within any string parse, but I don't simply which to do it very fun work. It two strings I might take from <stdin> my script from any input char and I want take all value between quotes from everyone string to variable. I can read any other lines very well, but on that lines I stand confused. So, which to pass quotes and have got text between quotes per string in variable?

Reply With Quote
  #5  
Old January 8th, 2009, 09:12 PM
baddy's Avatar
baddy baddy is offline
Salaryman
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: St. Louis, MO
Posts: 341 baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level)baddy User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 3 h 48 m 44 sec
Reputation Power: 69
Thumbs up

Quote:
Originally Posted by umbrella
I just need take value between " "(quotes)
currently I use perl.


Code:
if ($subject =~ m/(?<=").*(?=")/i) {
	# Successful match
	
	# show whats between quotes
	print $0; 
} else {
	# Match attempt failed
}

Reply With Quote
  #6  
Old January 17th, 2009, 08:52 PM
umbrella's Avatar
umbrella umbrella is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 85 umbrella User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 38 m 31 sec
Reputation Power: 5
thanks for reply, but it doesn't work...
Code:
# echo 'set = str("\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");' | perl -e 'while(<>){$_ =~ m/(?<=").*(?=")/i;print $_;}'
set = str("\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");

I'm anticipate something like on it..
"\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > Pasre sign between quotes

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap