Re: How does the pattern work in the Search function?

Home Forum General How does the pattern work in the Search function? Re: How does the pattern work in the Search function?

#5417

The Search function searches for the specified pattern within the text field and returns the position of pattern. If there is no matching pattern, -1 is returned. Flags can be used to provide more control and may be chained together if needed, as in ‘gis’.

g: Replaces all occurrences of pattern rather than just the first one.

i: The function is executed without case sensitivity.

s: Within the pattern or replace text parameters, the dot ‘.’ character matches new-line characters.

m: The caret (^) character and dollar sign ($) match before and after new-line characters. (This modifier corresponds to the multiline property of the RegExp instance.)

x: White space characters are ignored in the pattern so that you can write more readable constructors.

If you are searching for all the separate options, you will have to have a different search function for each possible combinations.