Thanks buddies !
I am sure that in next couple of hours, will able to write complex regex !
--
Sandip
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
Well for the example string you have given, this does the job :
reg = /(.*):\s+(.*)/
s = HYDERABAD/NEW DELHI: Andhra Pradesh chief minister was
reg.match(s)
location = $1 # = HYDERABAD/NEW DELHI
plain_content = $2 # = Andhra Pradesh chief minister was
Thanks Regards,
Dhruva Sagar.
Thanks !
What will be the regular expression to extract
*IANS* and *3 September 2009, 02:57pm IST*
from following string
* IANS 3 September 2009, 02:57pm IST *
Sandip
--
Ruby on Rails Developer
http://sandip.sosblog.com
http://funonrails.wordpress.com
www.joshsoftware.com
reg = /(.*)\s([0-9]\s.*)/
s = IANS 3 September 2009, 02:57pm IST
reg.match(s)
location = $1.strip # = IANS
plain_content = $2.strip # = 3 September 2009, 02:57pm IST
Thanks Regards,
Dhruva Sagar.
Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html -
The trouble with a
Hi
If i have an file name bangalore.txt
if i wanna remove .txt and assign bangalore to temp variable how can
it achieve.
Regards
prashanth
On Fri, Sep 11, 2009 at 5:13 PM, Dhruva Sagar dhruva.sa...@gmail.comwrote:
reg = /(.*)\s([0-9]\s.*)/
s = IANS 3 September 2009, 02:57pm
1. Go to Google.com
2. Type keywords: Ruby File basename
3. Press I am feeling lucky
Thanks,
Abhinav
--
अभिनव
http://twitter.com/abhinav
On Fri, Sep 11, 2009 at 5:37 PM, prashanth hiremath
prashanthhirema...@gmail.com wrote:
Hi
If i have an file name bangalore.txt
if i
If you need RegExp help this would help you :
s = 'Bangalore.txt'
regexp = /(.*)\.(/*)/
regexp.match(s)
baseName = $1 # = Bangalore
But I must say, you should try google a bit more often as Abhinav mentioned.
Thanks Regards,
Dhruva Sagar.
Ted Turner
Here's what we came up with using StringScanner:
def processed_answer
scanner = StringScanner.new(correct_answers)
# last position the scanner was in
last_pos = 0
output = []
while scanner.scan_until(/\[(.+?)\]/) # non-greedy matching so we
only swallow the first bracket
8 matches
Mail list logo