skip to Main Content

Php – Extract all <a> and <img> tags (exactly as represented in the input) from HTML 5 that contain a specific class

I need to improve some open source code. It contains a function to extract all <a> and <img> tags with a specific class from a string that represents HTML. This function uses regular expressions: preg_match_all('#<img(.*)class="(.*)foo(.*)"(.*)>#Umsi', $text, $matches_img, PREG_PATTERN_ORDER); preg_match_all('#<a(.*)class="(.*)foo(.*)">(.*)</a>#Umsi', $text,…

VIEW QUESTION

Javascript – Comma separated mobile number Regex validation

I'm trying validation for mobile number(With country code) which is not working. Posting the validation criteria below: Valid Numbers: +18790912345 (Valid) +18790112345,+18790123409 (Valid) +1-2569890912345 (Valid) +1-2569890912345,+939890912098 (Valid) -19890123909 (Valid) Invalid Numbers: +1909890 (Invalid) 9800112345 (Invalid - without country code) +1…

VIEW QUESTION

Postgresql – Split string using Regex in Postgres function

I need help splitting the string below using REGEXP_SPLIT_TO_ARRAY in a Postgres function: keyone="valone" key_two="val two" KEY_THREE=val three keyfour="http://sample.domain?par1=val1&par2=val2" keyFIVE=valfive and the resultant array should look like this: (keyone="valone",key_two="val two",KEY_THREE=val three,keyfour="http://sample.domain?par1=val1&par2=val2",keyFIVE=valfive) I ended up with this myarray := REGEXP_SPLIT_TO_ARRAY(mystring, E'\s(?=([^"]*"[^"]*")*[^"]*$)');…

VIEW QUESTION
Back To Top
Search