Regex-simple regular expression parsing

Source: Internet
Author: User
Tags php regular expression
The following is the php regular expression of the parsing template given by the recipient. I want to use it in java because it is a regular expression and I hope you can help me. thank you !! My question: I understand preg_replace (). This method requires three parameters: the first is a regular expression, the second is a string to be replaced, and the third is the template code, the replaced template code is returned. The first parameter in java reports an error. I don't know if the syntax is incorrect. if you want to use it in java, I hope you can give me some advice !! * ** Resolution template ** @ param $ str template content * @ returnture * publicfunction... regexphpjava

The following is the php regular expression of the parsing template given by the recipient. I want to use it in java because it is a regular expression and I hope you can help me. thank you !!
My question: I understand preg_replace (). This method requires three parameters: the first is a regular expression, the second is a string to be replaced, and the third is the template code, the replaced template code is returned. The first parameter in java reports an error. I don't know if the syntax is incorrect. if you want to use it in java, I hope you can give me some advice !!
/**
* Parsing template
*
* @ Param $ str template content
* @ Return ture
*/
Public function template_parse ($ str ){
$ Str = preg_replace ("/{view \ s + (. + )}/"," ", $ Str );
$ Str = preg_replace ("/{template \ s + (. + )}/"," ", $ Str );
$ Str = preg_replace ("/{include \ s + (. + )}/"," ", $ Str );
Return $ str;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.