Sublime Forum

Regex ^ when selecting doesn't work in Sublime 4 but in Sublime 3 works

#1

Try to search regex ^\w in selected line that began with text or symbol, -sublime 4 selecting not working.

In sublime 3 there no such a problem.

Please watch giff

maby there is some config change to make it work again?

0 Likes

#2

It turns out to be a bug. Regex: Caret not matching beginning of multiline selection

0 Likes

#3

Thanks!! For link. yep and from now its more than year passed from reporting.

0 Likes

#4

And again Sublime 3 - WORKS when selecting

Sublime 4 doesn’t work when selecting

0 Likes

Regex: Caret not matching beginning of multiline selection
#5

The solution for now its RegReplace plugin its awesome work :

Usage and info
packagecontrol.io
GIT

Jast type in sublime install plugin CMD+shift+P ant whrite RegReplace

Go to RegReplace setting and set:
"selection_only": true
//Set max size you want
"selection_input_max_size": 256,
"selection_input_max_count": 10000,

Then go to: Sublime Text/Packages/User/reg_replace_rules.sublime-settings

//write regex command you want for example to find the line bagan with word:
“find_first_word”: {
“find”: “^\w.*$”,
},

Add a hotkey or menu in:
hotkey for macos: Sublime Text/Packages/User/Default (OSX).sublime-keymap

for menu /Users/z/Library/Application Support/Sublime Text/Packages/User/Main.sublime-menu

{ “caption”: “p”,
“mnemonic”: “Z”,
“id”: “dev”,
“children”: [
{ “caption”: “Find First Word”,
“command”: “reg_replace”,
“args”: {“replacements”: [“find_first_word”],“regex_full_file_with_selections”: true,“action”: “select”}
},
]},

Then select text you like and press hotkey or menu item.

0 Likes

#6

if you have some solution or hack - you are funded, please write to…

and god regex help site [Regular Expressions Tutorial => Basics]
And visualize site: regex101
ssory for my poor English

0 Likes