You can modify the string being scanned reset or terminate the scanner find out or change the position of the scan pointer skip ahead and so on.
Ruby string scanner.
This method does affect the match register.
In other words your program will be able to tell.
Advances the scan pointer if advance pointer p otherwise not.
Given the string test string here are the pertinent scan pointer positions.
Advances the scan pointer if advance pointer p otherwise not.
Advancing the scan pointer.
You can look ahead in the string without actually scanning.
Returns the matched string if return string p is true otherwise returns the number of bytes advanced.
Scans the string until the pattern is matched.
Think about an email address with a ruby regex you can define what a valid email address looks like.
Scans the string until the pattern is matched.
Scan is a stringscanner class method which tries to match with pattern at the current position.
Usually immediately after it.
You can access the most recent match.
There are other methods besides the plain scanners.
Returns the matched string if return string p is true otherwise returns the number of bytes advanced.
The point of scanning is to move forward a bit at a time so matches are sought after the scan pointer.