firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.26k stars 199 forks source link

"No delimiters" mode #1980

Open AngryLoki opened 1 year ago

AngryLoki commented 1 year ago

Feature

Right now there is a following complaint in Regex101:

image

However common cases for regexps are:

For such cases there is a suggestion to introduce a new URL flag &delimiter=none and support "No delimiters" mode in UI.

OnlineCop commented 1 year ago

Do you see that delimiter on the left side there, with that /?

image

In regex flavors that support different delimiters, you should be able to click that (next to the vertical triple-dot bar) to change delimiters from / to one of several other options.

sunkin351 commented 1 year ago

Do you see that delimiter on the left side there, with that /?

image

In regex flavors that support different delimiters, you should be able to click that (next to the vertical triple-dot bar) to change delimiters from / to one of several other options.

This is not available for the .NET regex, which I am attempting to use. Furthermore, I can't have the " character in my regex at all, due to the following errors:

" An unescaped delimiter must be escaped; in most languages with a backslash (\)

\" This token has no special meaning and has thus been rendered erroneous

Damned if I do escape it, damned if I don't.

OnlineCop commented 1 year ago

When you switch to the .NET flavor, its delimiter is " so to match a literal double quote, write it 2x: ""

""(?>[^\\""]+|[\\].)*""
sunkin351 commented 1 year ago

I see, thanks for that clarification.

AngryLoki commented 1 year ago

@OnlineCop , sorry if my explanation was not clear.

I definitely know about "Change delimiter" dropdown. However, it requires to select some value. Below is a correct regular expression for PCRE/JS/many other regex engines:

[/~@;%`#]

It will work in VSCode, Pycharm, WebStorm, Notepad++, basically any software that supports regular expressions. It will work in any language if you read this expression from text file or database. However it won't work in Regex101 in any current mode.

ThiefMaster commented 11 months ago

I'd also like to see "no delimiter" mode. When the regex is stored e.g. in a database you do not have to worry about delimiters (at least in Python, YMMV if you have to deal with PHP 🙈).