String replacement
For example i have this string: $test_str = "num Test \n num Hello \n num World"; And i need to replace these num-s to increasing numbers. like that "1 Test \n 2 Hello \n 3 World" How could i do this? ...
For example i have this string: $test_str = "num Test \n num Hello \n num World"; And i need to replace these num-s to increasing numbers. like that "1 Test \n 2 Hello \n 3 World" How could i do this? ...
Hi, I want to know what regular expression should be applied to replace 1 - 55 of 55 to only get 55 in Regex module of yahoo pipes. Thanks ...
Hi, I need to ensure that a input string follows these rules: It should contain upper case characters only. NO character should be repeated in the string. eg. ABCA is not valid because 'A' is being repeated. For the upper case thing, [A-Z] should be fine. But i am lost at how to ensure no repeating characters. Can someone suggest s...
When i wrote the following, i get such warning, and it doesn't match anything, but i'm sure, that $row_search['content'] contains $value... preg_match_all("/[^\s]*".preg_quote($value)."[^\s]*/iu", $row_search['content'], $final_matched); WARNING:preg_match_all() [function.preg-match-all]: Unknown modifier '/' in C:\xampp\htdocs\finance...
I have a file with many lines in it like this: (this is the output of windows tasklist) "wmiprvse.exe","3596","Console","0","5,632 K","Running","NT AUTHORITY\NETWORK SERVICE","0:00:00","N/A" and I want to change it to this: wmiprvse.exe,NT AUTHORITY\NETWORK SERVICE,N/A I used sed (unxutils) to reformat the output: But it d...
Hello, i have some problem with pattern bellow: /([A-Z0-9]+[A-Z0-9\.\_\+\-]*){3,64}@(([A-Z0-9]+([-][A-Z0-9])*){2,}\.)+([A-Z0-9]+([-][A-Z0-9])*){2,}/i It match email addresses and i have problem with this rule: [A-Z0-9\.\_\+\-]* If i remove the star it works but i want this characters to be 0 or more. I tested it on http://regexpal....
hi all, maybe this is a stupid question but : i run perl 5.8.8 and i need to replace any underscore preceded by a number, with "0". running : $var =~s /(\d)_/$10/g; obviously does not work as $10 is interpreted as... well... $10, not "$1 followed by 0" moreover, as runing perl5.8, i can't do $var=~s/(?<n1>\d)\_/$+{n1}0/g; any i...
Say I have a search string like: "Hello [NAME], how are you today? I am fine." If I were to use a regex pattern to search text I would have to convert it to something like (assuming that '\ ' is a valid regex search for a single space): "\Hello\ \[NAME\],\ how\ are\ you\ today\?\ I\ am\ fine." Now before I go off and try to write a f...
I'm working on a multilingual application that uses IIS7-based url rewriting. I'd like the following Url actions: 1. fr-ca > index.aspx?l=&lc=fr-ca 2. fr-ca/ > index.aspx?l=&lc=fr-ca 3. fr-ca/568/sometitle > index.aspx?l=568&lc=fr-ca 4. 568/sometitle > > index.aspx?l=568&lc= Essentially, the initial fr-ca is optional. My current rul...
I tried a simple script with arr = data.scan /<td>([^<]+)/ and the arr is filled with the data within the <td> and </td> when it is run using ruby try.rb but when it is run using ruby script/runner app/try.rb so that it is run just like inside of script/console, then now there is an extra </td> attached to the matched data... ...
hi, how can i check for a pattern occuring a certain number of times? eg: 4444444 => return 4 4444332 => return 4 4444431 => return 4 4443333 => return 0 4243424 => return ? but if character 4 occurs less than 4 times then return 0 i am just looking for 4 here. if it appears more than or equal to 4 times then value returned woul...
Would it be possible to select using a regular expression in jQuery? Something like $('input[name=^[a-z]+_[1-9].*]') ...
I'm building a filter plugin in Wordpress and I'm replacing some plugin specific tags with bits of html. Example: [VIDEO ID=12] will be replaced via preg_replaced in this function function display_video($text){ $pattern = '/\[VIDEO ID\=\d+\]/'; $text=preg_replace($pattern,get_video_block($id),$text); return $text; } I'm n...
Hi, I need some Regex help. I've got a series of numbers. For example: 2010 95 34% 22 55% I use this Regex to put add quotation marks and commas: ([\d.]+%?) '$1', It works great. But, I need to strip the % sign. How do I edit the above Regex to do so? Thank you! -Laxmidi ...
I got a contact form, I need to filter some words. I'm doing it as following: $array = array('lorem', 'ipsum', 'ip.sum'); for($i = 0; $i < count($array); $i++) { if( preg_match("/".$array[$i]."/", (string) $field) ) { return false; } } I'm not a regex master, but it ...
Before saving into database i need to delete all tags delete all more then one white space characters delete all more then one newlines for it i do the following $content = preg_replace('/<[^>]+>/', "", $content); $content = preg_replace('/\n/', "NewLine", $content);it's for not to lose them when deleting more then one white sp...
i need to parse the url and title from multiple href tags in a string regex... i need to get each url and title into a variable eg. <DT><A HREF="http://www.partyboatnj.com/" ADD_DATE="1210713679" LAST_VISIT="1225055180" LAST_MODIFIED="1210713679">NJ Party Boat - Sea Devil of Point Pleasant Beach, NJ</A> <DT><A HREF="http://www....
How would one write a regex that matches a pattern that can contain quotes, but if it does, must have matching quotes at the beginning and end? "?(pattern)"? Will not work because it will allow patterns that begin with a quote but don't end with one. "(pattern)"|(pattern) Will work, but is repetitive. Is there a better way to do t...
I've a document from which I need to extract some data. Document contain strings like these Text:"How secure is my information?" I need to extract text which is in double quotes after the literal Text: How secure is my information? How do I do this with regex in Javascript ...
Hi, I'm currently working on a pipe on Yahoo! Pipes. I got a RegExp to match an URL. Now, I need to match the unmatched in order to delete it, so that there is only my URL. My RegExp is: [A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+ How do I invert the matching? (It has to be done via another RegExp, YPipes doesn't support an...