RegEx.SearchStartPosition

From Xojo Documentation

Property (As Integer )
aRegEx.SearchStartPosition = newIntegerValue
or
IntegerValue = aRegEx.SearchStartPosition

Supported for all project types and targets.

The byte offset at which you want to start the search if the optional TargetString parameter to Replace is not specified.

Notes

Keep in mind: If you set it, it will only be used if you don't specify a TargetString, since setting a new TargetString resets the value.

The offset is zero-based!. I.e. to start at the beginning of the string, use 0.

If you want to set a start value past the first character, and if the string uses an encoding where not every character is exactly one byte long, such as UTF-8, you need to convert the string's character position into its byte offset.

Here’s a way to convert a (1-based) character position into the (0-based) byte position:

 aRegEx.SearchStartPosition = theString.Left(characterPosition-1).Bytes