Tag preg-match

[Solved] Preg_match on multiline text

The idea is to avoid the issue of new lines by not using the dot ($subject is your string): $pattern = ‘~ Project\hNo\.\h\d++\hDATE\h (?<date>\d{1,2}\/\d{1,2}\/\d{1,2}) \s++No\.\hQUESTION\hANSWER\s++ (?<No>\d++)\s++ # all characters but D or D not followed by “ate Required” (?<desc>(?>[^D]++|D(?!ate\hRequired))+) \D++…

[Solved] How to get attribute of href on the basis of selected text? [closed]

Try this : put id for anchor tag <a id=”anchor1″ href=”https://stackoverflow.com/questions/25931155/site.com/register.php?mid=username&mode=bn&bid=1″> use below javascript <script> var href = document.getElementById(‘anchor1’).href; //get index of ? var indexStart = href.indexOf(‘?’); var indexLast = href.length; //get href from ? upto total length var params…

[Solved] Preg_match for a string key

The regex would be this: /^[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}$/ Regex explanation: Start regex expression /^ Capital A-Z and Numerical 0-9 [A-Z0-9] 5 long exactly {5} Dash between sets End expression $/ <?php $reg = ‘/^[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}$/’; $string = ‘YTMG3-N6DKC-DKB77-7M9GH-8HVX7’; preg_match($reg, $string, $matches, PREG_OFFSET_CAPTURE); print_r($matches);…

[Solved] More than one preg_match queries? [closed]

if(preg_match($fullname_pattern,$fullname)) Remove Last “)” And add here (preg_match($password_pattern,$password))) Like this: if(preg_match($fullname_pattern,$fullname) && preg_match($email_pattern,$email) && preg_match($password_pattern,$password) ) { 1 solved More than one preg_match queries? [closed]

[Solved] Finding month preg-match

I make a snippet for you, so you can start from here $str=”December 2012 Name: Jack Brown”; $ptr = “/^(?P<month>:Jan(?:uary)?|Feb(?:ruary)?|Dec(?:ember)?) (?P<year>:19[7-9]\d|2\d{3}) (Name:(?P<name>(.*)))/”; preg_match($ptr, $str, $data); echo ‘For ‘.trim($data[‘name’]).’ – ‘.$data[‘month’].’ ‘.$data[‘year’]; the result will be ‘For Jack Brown – December…