Jump to content

JavaScript RegExp to AutoIt Func ?


Recommended Posts

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 by etusa
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...