This is a very basic question, but I am just getting started so I could use some help.
I want to create an element that recognizes the text between asterisks as element.comment.first.
For example if I type: * Textmate * This would be identified as element.comment.first.
So I wrote the following in my "language" section: { name = 'element.comment.first'; match = '[*]\s?([^* ]|.| [*] | )*[*]'; },
The problem is it can't identify the element when it comes in the middle or end of a line, i.e. I want to learn how to use * Textmate * tomorrow.
What's between the asterisks is not considered an element.comment.first.
Any suggestions or help would be much appreciated. Thanks.
On 17/8/2006, at 22:04, Lawrence Goodman wrote:
[...] For example if I type:
- Textmate *
This would be identified as element.comment.first.
So I wrote the following [...]
match = '[*]\s?([^\* ]|\.| [*] | )*[*]';
That is a somewhat puzzling pattern. It matches *, optional whitespace, a sequence of ‘not * or space’ or the ‘.’ character, or the ‘ * ’ sequence. And then finally a ‘*’.
The second branch is redundant and the third I think is unwanted.
The problem is it can't identify the element when it comes in the middle or end of a line, i.e. I want to learn how to use * Textmate * tomorrow.
What it can’t identify is when the terminating ‘*’ has spaces on both sides, as it will then be taken by your middle repeat, and the terminating state is never met.
Any suggestions or help would be much appreciated. Thanks.
Well, not entirely sure what you want to match, but sounds like just:
[*].*?[*]
That matches from asterisk to asterisk.
On 8/18/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 17/8/2006, at 22:04, Lawrence Goodman wrote:
[...] For example if I type:
- Textmate *
This would be identified as element.comment.first.
So I wrote the following [...]
match = '[*]\s?([^\* ]|\.| [*] | )*[*]';
That is a somewhat puzzling pattern. It matches *, optional whitespace, a sequence of 'not * or space' or the '.' character, or the ' * ' sequence. And then finally a '*'.
The second branch is redundant and the third I think is unwanted.
The problem is it can't identify the element when it comes in the middle or end of a line, i.e. I want to learn how to use * Textmate * tomorrow.
What it can't identify is when the terminating '*' has spaces on both sides, as it will then be taken by your middle repeat, and the terminating state is never met.
Any suggestions or help would be much appreciated. Thanks.
Well, not entirely sure what you want to match, but sounds like just:
[*].*?[*]
That matches from asterisk to asterisk.
Or
[*][^*]*[*]
Which looks even prettier (though the ^ does spoil it a little)
Ed
Thanks for the help. If you'll indulge me one more tiime:
So now I have written: { name = 'element.comment.first'; match = '[*][^*]*[*]'; },
If the line reads *;lk;lk* it captures what's between the asterisks. If the line reads *lkjsdflkjs* hello there *sjlfskjd*, it will capture both elements between the asterisks. BUT if the line is: Hello there *lskjdflsjdfsl* I want to go, it doesn't capture what is between the asterisks.
Any more suggestions?
Thanks.
On 8/18/06, Ed Singleton singletoned@gmail.com wrote:
On 8/18/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 17/8/2006, at 22:04, Lawrence Goodman wrote:
[...] For example if I type:
- Textmate *
This would be identified as element.comment.first.
So I wrote the following [...]
match = '[*]\s?([^\* ]|\.| [*] | )*[*]';
That is a somewhat puzzling pattern. It matches *, optional whitespace, a sequence of 'not * or space' or the '.' character, or the ' * ' sequence. And then finally a '*'.
The second branch is redundant and the third I think is unwanted.
The problem is it can't identify the element when it comes in the middle or end of a line, i.e. I want to learn how to use * Textmate * tomorrow.
What it can't identify is when the terminating '*' has spaces on both sides, as it will then be taken by your middle repeat, and the terminating state is never met.
Any suggestions or help would be much appreciated. Thanks.
Well, not entirely sure what you want to match, but sounds like just:
[*].*?[*]
That matches from asterisk to asterisk.
Or
[*][^*]*[*]
Which looks even prettier (though the ^ does spoil it a little)
Ed
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
this one should work. the last line allows to escape * inside comments with a backslash, remove it if that's not the case ;)
{ name = 'element.comment.first'; begin = '*'; end = '*'; patterns = ({ match = '\*'; }); }
ciao,
domenico