etusa Posted April 7, 2009 Share Posted April 7, 2009 (edited) How would this Javascript be written as Autoit Code? // Replace all doubled-up <BR> tags with <P> tags : var pattern = new RegExp ("<br/?>[ \r\n\s]*<br/?>", "g"); document.body.innerHTML = document.body.innerHTML.replace(pattern, "</p><p>"); Is what I wrote below, correct? $HTML = 'paragraph one<br><br>paragraph two<br><br> paragraph 3<br>' $sResult = StringRegExpReplace($HTML, '<br/?>[ \r\n\s]*<br/?>', '</p><p>') ConsoleWrite($sResult & @CRLF) Can someone explain to me precisely what this RegExp does? How can the RegExp be written so that it works with both <BR> and <br> (lower case)? Thanks in Advance. Edited April 7, 2009 by etusa Link to comment Share on other sites More sharing options...
ChangMinYang Posted April 7, 2009 Share Posted April 7, 2009 How would this Javascript be written as Autoit Code? // Replace all doubled-up <BR> tags with <P> tags : var pattern = new RegExp ("<br/?>[ \r\n\s]*<br/?>", "g"); document.body.innerHTML = document.body.innerHTML.replace(pattern, "</p><p>"); Is what I wrote below, correct? $HTML = 'paragraph one<br><br>paragraph two<br><br> paragraph 3<br>' $sResult = StringRegExpReplace($HTML, '<br/?>[ \r\n\s]*<br/?>', '</p><p>') ConsoleWrite($sResult & @CRLF) Can someone explain to me precisely what this RegExp does? How can the RegExp be written so that it works with both <BR> and <br> (lower case)? Thanks in Advance. The 30 Minute Regex Tutorial http://www.codeproject.com/dotnet/regextutorial.asp - by Jim Hollenhorst. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now