4 February 2024

If you're looking to use regular expressions (regex) to check if a specific character is present in a string, you can use the following pattern in most programming languages: the ? quantifier makes the preceding character optional.

If you want to select instances of the word "test" or "testa" where the presence of 'a' is conditional, you can use the following regex pattern:

Source code viewer
  1. testa?
Programming Language: PCRE