Regex matching 3rd word in a line?
Joe Francia
usenet at soraia.com
Fri Oct 31 03:02:56 EST 2003
Ian Gil wrote:
> I'm looking to match the 3rd (or whatever) word in a line, where word
> can be anything that's not white space.
>
> I'm not programming, but I'm using a program which says it uses python
> style regular expressions.
>
This will match the third word in a line:
^(?:\S+\s){2}(\S+)
Change the "2" to "whatever - 1" to match a different word.
Peace,
Joe
More information about the Python-list
mailing list