Page 1 of 1

Enhanced InStr

Posted: 08 Apr 2021, 15:57
by Coiler
I would love to have a InStr() type function for some of these things:
  • Locate the next white-space character / next non-white-space
  • Next alpha-numeric character / non-alpha-numeric
  • Next symbol character / non-symbol
  • etc

These routines can be made extremely efficient with an ascii lookup table. Does anyone know if RegExMatch can be used to do these things in similar time? I've tried to stick to InStr when parsing my own strings, but wow is it limited when you need to narrow in on something.

Another wish to throw at you is a character limit option (or a min/max pos range) for all InStr functions. Most of the time, the character I'm looking for needs to be within a certain number of characters of my giant string, but there's no way to ask for that.

Re: Enhanced InStr

Posted: 19 Apr 2021, 07:05
by braunbaer
Coiler wrote:
08 Apr 2021, 15:57
I would love to have a InStr() type function for some of these things:
  • Locate the next white-space character / next non-white-space
  • Next alpha-numeric character / non-alpha-numeric
  • Next symbol character / non-symbol
  • etc

These routines can be made extremely efficient with an ascii lookup table. Does anyone know if RegExMatch can be used to do these things in similar time? I've tried to stick to InStr when parsing my own strings, but wow is it limited when you need to narrow in on something.

Another wish to throw at you is a character limit option (or a min/max pos range) for all InStr functions. Most of the time, the character I'm looking for needs to be within a certain number of characters of my giant string, but there's no way to ask for that.
You can achieve all these requests perfectly well through Regexmatch. Regexmatch can be seen as (very) enhanced instr function.