Fix end of pattern detection for hex regex pattern.
Prevent updating multiple times on first load.