coldfusion - regex find content question -
using regex refind tag, trying to find content in brackets in this example using coldfusion
Joe Smith & Lt; Joesmith@domain.com>
The result should be the text
joesmith@domain.com
use it
& lt; Cfset reg = refind ("/(?<=\<).*?(?=\&&ic=http://www/domain.com>") />
No luck, no suggestions?
Maybe a syntax issue, it works in an online regex tester I use.
You can not use lookehind with CF's regex engine (uses)
However, if you can, however, that supports them, and I've made a cover CFC it becomes even easier. Available from:
(UPDATE: .. COPY CFC has been developed in a complete project mentioned above for information)
Besides, /.../s stuff is not required here / relevant
So, with your example, but with better regex:.
& lt; Cfset Jrex = createObject ('component', 'jre-utils'). Init () /> & Lt; Cfset reg = jrex.match ("(? & Lt; = & lt;) [^ ] + (? = & Gt;)," Joe lie liege; joe@domain.com> ") />
A quick note, because I have updated that many times regex; Hopefully this is at its best now ...
(? & Lt; = & lt;) # looks positive - start matching ` ; `` If it succeeds, it should not capture
Comments
Post a Comment