in reply to regex word return
If the pattern has three captures, it will return the three substrings it captured if successful.
If the pattern has two captures, it will return the two substrings it captured if successful.
If the pattern has one capture, it will return the substring it captured if successful.
If the pattern has no captures, it will return nothing? No. You wouldn't be able to tell whether the match was successful or not if it returned nothing on both success and failure.
So, if you want to capture something, you gotta tell it what you want it to capture.
|
|---|