D
D
daMage2015-01-19 23:52:13
Regular Expressions
daMage, 2015-01-19 23:52:13

What is the correct way to write a regular expression for "option"?

Hello. I can't make a regular expression for any command option. The regular is needed for the sublime theme. Actually, the option begins either with "-" or with "--". Initially, such a construction was written -{1,2}[\w-]+, but I did not take into account phrases with a dash. Then I decided to add \W at the beginning and everything would be fine, if you do not take into account that the option can be at the beginning of the line.
By the way, the theme turned out to be quite beautiful, who also thinks, I can throw off the source code.
27d3d399e38741dd963af2d665f72393.png
UPD #1
76d7a710db7a4f32a2f36f4f34f00b72.png
Problem - unnecessary highlighting in "file-fafa"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Askar Familiev, 2015-01-20
@askarik

what exactly is required?
I want to help, but I did not understand the essence of the task,
should I just select these options?
what if like this:
(-){1,2}([^\s])+
if options always come first in the line, but they can have spaces in front, put tabs (\s)* in front

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question