<!IFREGEX

Rate this post

In the latest snapshot of DataparkSearch Engine: an new conditional operator <!IFREGEX has been added for search result template. Using it you can as check value of meta-variable before output, as alter it according regex pattern specified.

E.g., auxiliary search in phone directory on All Sochi's Internet site translates phone numbers in canonical form of +78622xxxxxx into widely used local one: xx-xx-xx; and other numbers are translated from canonical form +7xxxyyyzzzzzz into better looked +7-xxx-yyy-zz-zz-zz using the following code in search template:


<!IFREGEX NAME="tel" CONTENT="\+78622([0-9][0-9])([0-9][0-9])([0-9][0-9])(.*)">$1-$2-$3$4
<!EREGEX NAME="tel" CONTENT="\+7([0-9][0-9][0-9])([0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])(.*)">+7-$1-$2-$3-$4$5
<!ELSE>$&(tel)<!ENDIF>

Leave a Reply

Your email address will not be published. Required fields are marked *