Sign in to follow this  
Followers 0
nago

Regular Expressions, Remembering Patterns

3 posts in this topic

Hello!

I know in sed you can write something like:

s/ab\(.*\)cde/\1/

where sed will match for ab[wildcard]cde, but whenever it matches this, it saves the part in parenthesis (here the wildcard) in my example, to \1.

How do you accomplish this in AutoIt? For example, parsing an HTML file to find what's within a header:

$pattern = '<h3>.*</h3>'
StringRegExp($input,$pattern)

How do I recall what .* matched?

Share this post


Link to post
Share on other sites



Hello!

I know in sed you can write something like:

s/ab\(.*\)cde/\1/

where sed will match for ab[wildcard]cde, but whenever it matches this, it saves the part in parenthesis (here the wildcard) in my example, to \1.

How do you accomplish this in AutoIt? For example, parsing an HTML file to find what's within a header:

$pattern = '<h3>.*</h3>'
StringRegExp($input,$pattern)

Share this post


Link to post
Share on other sites

That's the ticket.

(.*) used with $reg is what I was questing for.

Thank you!

Share this post


Link to post
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
Sign in to follow this  
Followers 0