in reply to word with some number in between
I wish to seperate out only those words which have atleat one number in it
Have a look at regular expressions and grep!
(hooked on the Perl Programming language)
hey i did this , but there is some issue with the command , the first $ is not a part of regex as per perl . with this regex what i tried doing is that some $ before num and some $ after it . please tell what is the mistake
if ($array_A[$i] =~ /^$+[0-9]+$/)
The /^$+ part makes no sense. If you you just want to test for the presence of digits then a simple /[0-9]/ will work splendidly.
Continuing hippo's advice, you should continue to the grep part next.
" ... what i tried doing is that some $ before num and some $ after it "
Do you, by any chance, mean you tried to deal with data that included a "$" sign... such as:
abc12$ or $98abc or $$zyx5abc or something similar?
If so, you'll have to escape the "$" sign (with a preceding backslash, "\") in your regex.
Otherwise, (slightly oversimplified), the regex engine uses the "$" sign is only to mark an EOL.
Updated by quoting a possibly mis-understood part of OP's latest question.
1. Keep it simple
2. Just remember to pull out 3 in the morning
3. A good puzzle will wake me up
Many. I like to torture myself
0. Socks just get in the way
Results (289 votes). Check out past polls.