> --
> You received this message because you are subscribed to the
> "TextWrangler Talk" discussion group on Google Groups.
> To post to this group, send email to textwr...@googlegroups.com
> To unsubscribe from this group, send email to
> textwrangler...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/textwrangler?hl=en
> If you have a feature request or would like to report a problem,
> please email "sup...@barebones.com" rather than posting to the group.
^(.*?),.*
--
Christopher Bort
<top...@thehundredacre.net>
<http://www.thehundredacre.net/>
Skype: topherbort
please email "sup...@barebones.com" rather than posting to the group.
Right -- ^(.*) means "at beginning-of-line" find zero or more of ANY character, which is what it's doingthen ,.*$ means find a comma and anything that follows to end-of-lilneWhat you want is the carat inside the square [] character-list brackets:^([^,]*),.*$which means^ at beginning of line[^,] any character EXCEPT a comma* zero or more times,.* followed by a comma and then any character, zero or more times$ up to the end-of-lineNote that if you have a line with NO comma, this will not match (but the end result may be what you're after anyway).The square brackets are very interesting:[a-f] finds a, b, c, d, e or f.[^a-f] finds ANY character EXCEPT a, b, c, d, e or fWhen ^ is the first item inside the [] character-list brackets, ^ means NOT, as in [^,] means anything BUT a commaWhen ^ is outside of the [] brackets then it means beginning-of-line(Hmm, I wonder if the ^ carat has a defined meaning if it's NOT at the beginning of a [] character-list, hmm...)
As a more general purpose solution where you're parsing simple CSV data (without quotes and embedded commas in field data) try this:^([^,]*,){3}([^,]*)(,[^,]*){8}$If you were looking for the fourth field of 12, it'd be in \2 (\1 would contain fields 1-3, \3 would contain the last 8. Modify the {#} numbers according to your needs.
--
You received this message because you are subscribed to the
"TextWrangler Talk" discussion group on Google Groups.
To post to this group, send email to textwr...@googlegroups.com
To unsubscribe from this group, send email to
textwrangler...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/textwrangler?hl=en
If you have a feature request or would like to report a problem,
please email "sup...@barebones.com" rather than posting to the group.
--
will trillich
"I just try to make sure that the laziest thing I can do at any moment is what I should be doing." -- matt.might.net
--
You received this message because you are subscribed to the
"TextWrangler Talk" discussion group on Google Groups.
To post to this group, send email to textwr...@googlegroups.com
To unsubscribe from this group, send email to
textwrangler...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/textwrangler?hl=en
If you have a feature request or would like to report a problem,
please email "sup...@barebones.com" rather than posting to the group.
--
will trillich
"I just try to make sure that the laziest thing I can do at any moment is what I should be doing." -- matt.might.net
--
You received this message because you are subscribed to the
"TextWrangler Talk" discussion group on Google Groups.
To post to this group, send email to textwr...@googlegroups.com
To unsubscribe from this group, send email to
textwrangler...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/textwrangler?hl=en
If you have a feature request or would like to report a problem,
please email "sup...@barebones.com" rather than posting to the group.