Ok, back at a computer and need a slight change above. The second “.” needs to be “.{2}”
q: exists matches (regex "^.{0,1}AS.{2}G1") of "ASDFG1234567890"
A: True
q: exists matches (regex "^.{0,1}AS.{2}G1") of "-ASDFG1234567890"
A: True
q: exists matches (regex "^.{0,1}AS.{2}G1") of "@ASDFG1234567890"
A: True
q: exists matches (regex "^.{0,1}AS.{2}G1") of "GASDFG1234567890"
A: True
q: exists matches (regex "^.{0,1}AS.{2}G1") of "GABDFG1234567890"
A: False
( the "AS" is not matched)
q: exists matches (regex "^.{0,1}AS.{2}G1") of "GASDFGX234567890"
A: False
(the "G1" is not matched)
Explanation of the regex:
^ = Match from the start of the string
.{0,1} = Match any character, 0 or 1 time
AS = Match the literal string "AS"
.{2} = Match any character, exactly 2 times
G1 = Match the literal string "G1"