You can even use what was captured in the same regex. If you want to reference what was captured later, like in a replacement, you can just reference it by calling $1 (or \1). Will match abc, but it will capture and store b in the 1st capture group, $1 (or \1). You do this by adding parenthesis around whatever it is you want to capture. That's a very good question! Here's how it works: when you write a regular expression, you can capture (have regex "remember") stuff that you matched.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |