Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • @Joseph: thanks, however, based on my task I feel like grep is more natural, like ghostdog74 suggested. Just need to figure out how to make grep output the capture groups only, not the whole match.
    – Pablo
    Commented May 6, 2010 at 5:59
  • 2
    Just a note, but the plus sign '+' means 'one or more' which would remove the need for repeating yourself in the patterns. So, "[0-9][0-9]*" would become "[0-9]+" Commented Apr 12, 2012 at 17:31
  • 5
    @RandomInsano: In order to use the +, you would need to escape it or use the -r option (-E for OS X). You can also use \{1,\} (or -r or -E without the escaping). Commented Apr 18, 2012 at 22:02