Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Can $stringregexp return a character number?

$
0
0
Hi all.  Is there any simple/quick method (function or otherwise) to search for a string for a substring using wildcards and such (like is done with the function stringregexp), and, when a match is found, have it return the character number in the string of the match? Edit: For example, searching the string "I am 5 years old" for anything matching \d* would return 6 (i.e. the first string of numbers occurs at the 6th character in the string).

I'm quite sure stringregexp can only return True or False, and functions like StringinString seem to require an exact string to look for.  I've searched the forums and web, but haven't found anything so I thought I'd ask.  Such a search may provide a large amount of hits, and may possibly get a little ambiguous or infinite-y.  For example, searching the string "123" for anything matching \d* could conceivably return 6 hits, right?  Three hits would be at position 1, two hits at position 2, and one hit at position 3.  Or I maybe I'm misunderstanding the search protocols.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>