简体   繁体   中英

Regular Expression in php, extracting string between tags and replace it

I have the following HTML and what I want is to extract the string between two tags and replace another string with the one that was extracted. Here is an example:

<p>|something=to remember:yes: no</p>
<p><A:keyword term="to remember, yes no" /></p>

I have built something like this but I do not know whether regular expressions really help me here?

<[p]\>(.*)<\/p>

Thanks for your help. I solved my problem by using

something==([A-Za-z]*)\s([A-Za-z]*),\s([A-Za-z]*)\s([A-Za-z]*)

as a static input and then everything after it was treated with regex and grouping. With that solution I did solve my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM