[Solved] Regular Expressions pattern to extract particular digits from text [closed]

Try this: \b(?:256\d{9}|07[17-9]\d{8})\b Explanation: <!– \b(?:256\d{9}|07[17-9]\d{8})\b Options: ^ and $ match at line breaks; free-spacing Assert position at a word boundary «\b» Match the regular expression below «(?:256\d{9}|07[17-9]\d{8})» Match either the regular expression below (attempting the next alternative only if this one fails) «256\d{9}» Match the characters “256” literally «256» Match a single digit 0..9 … Read more

[Solved] Php preg_match_all, wordpress function [closed]

The code you found on the internet is kind of irrelevant. In order to achieve what you want you need something like this: $str = “[image name=ubuntustudio-tribal-54] “; $pat = “~\[image name=([^\]]+)~i”; preg_match($pat, $str, $matches); $name = $matches[1]; After that $name would be bound to ubuntustudio-tribal-54. See the docs for more details regarding PHP’s preg_match. … Read more

[Solved] How to I preg_match_all starts with “http” and ends with (“) or (‘) or white space(tabs, space, line break)

i suggest you use parse_url to fetch parts of urls! Take a look at php.net EDIT : $file = file_get_contents( YOUR FILE NAME ); $lines = explode(“\r\n”, $file); foreach( $lines as $line ){ $urlParts = parse_url( $line ); if( $urlParts[‘scheme’] == ‘http’ ){ // Do anything … } } CHANGE : oOk, i don’t know … Read more