Regex matching 3rd word in a line?

I

Ian Gil

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.


Ian
 
J

Joe Francia

Ian said:
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
 
I

Ian Gil

I'm looking to match the 3rd (or whatever) word in a line, where word
This will match the third word in a line:

^(?:\S+\s){2}(\S+)

Change the "2" to "whatever - 1" to match a different word.

This worked except it's matching from the beginning up to the third word
and I'm looking to match just the third word. I tried some variations of
it but apparently not the right ones.

Thanks,

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top