Hi,
I'm having a bit of a trouble to match a '.' which is part of a string surrounded by " ". I've tried: (?=".*).(?=.*".*$), but this doesn't seem to work.
Can anyone please help out?
Regards, Jeroen.
Jeroen jeroen@je-ju.net wrote:
Hi,
Hi
I'm having a bit of a trouble to match a '.' which is part of a string surrounded by " ". I've tried: (?=".*).(?=.*".*$), but this doesn't seem to work.
Can anyone please help out?
Find : "(.*)?.(.*)?" Replace : first name: $1 ; second name: $2
will change : "jo.bar" to : first name: jo ; second name: bar
But imho, there must be even easier way to do it,
On 16. Oct 2004, at 15:05, Jeroen wrote:
This matches the complete string and I only want to match the periods enclosed in strings, it's for syntax highlighting...
Ah, in that case use the begin/end patterns and make the dot a sub pattern. Or if it's for styling, use the ability to style captures :)
Kind regards Allan
Allan Odgaard allan@macromates.com wrote:
Or if it's for styling, use the ability to style captures :)
Perhaps i've missed a step, but what do you mean by "style captures"? Found nothing in the Help file, nor in the Wiki. (only notice the smiley :)
On 16. Oct 2004, at 15:25, José Campos wrote:
Or if it's for styling, use the ability to style captures :)
Perhaps i've missed a step, but what do you mean by "style
captures"? Found nothing in the Help file, nor in the Wiki. (only notice the smiley :)
It's in the last few paragraphs. If for example we want to underline a dot in a string, we could do (for readability, I'm leaving out quotes, escapes, and semicolons):
match = »"[^"]*(.)[^"]*"« fontStyle[1] = »( underline )«
By appending [1] to fontStyle, we affect the style only for the 1th capture of the match. The other way to do it would have been (assuming we want the string to be on a single line here):
begin = »"(?=.*")« end = »"« patterns = ( { match = ».« fontStyle = »( underline )« } )
Kind regards Allan
Allan Odgaard allan@macromates.com wrote:
It's in the last few paragraphs. If for example we want to underline a dot in a string, [...]
OK, I was trying to find this feature in the Find/Replace dialog box, now I understand (how powerful TM is :)
On 16. Oct 2004, at 14:44, Jeroen wrote:
I'm having a bit of a trouble to match a '.' which is part of a string surrounded by " ".
So you only want to match the single dot? This is currently not possible (AFAIK) since there is no look-behind assertions. But if this is for search and replace, you can use something like: »("[^"]*).([^"]*")« and in the replacement string do »$1-$2« to e.g. turn it into a dash.
Kind regards Allan