Advancing the scan pointer.
Ruby string scanner.
There are other methods besides the plain scanners.
This method does affect the match register.
Scanning a string means remembering the position of a scan pointer which is just an index.
Returns the matched string if return string p is true otherwise returns the number of bytes advanced.
Scan is a stringscanner class method which tries to match with pattern at the current position.
Advances the scan pointer if advance pointer p otherwise not.
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.
Scans the string until the pattern is matched.
In other words your program will be able to tell.
Scans the string until the pattern is matched.
Usually immediately after it.
This method does affect the match register.
Advances the scan pointer if advance pointer p otherwise not.
Think about an email address with a ruby regex you can define what a valid email address looks like.
You can look ahead in the string without actually scanning.
Given the string test string here are the pertinent scan pointer positions.
You can access the most recent match.