Search and Replace with RegEx components in Atom editor - regex

I want to search and replace this
`https://example.com/`{.uri}
to
[https://example.com/](https://example.com/)
With vim I would do a s/(http.*){.uri}/[\1](\1)/g but that doesn't work with atom.io. How can I solve this?

If you Cmd-F and open the search pane, there is a ".*" button at the right side. Click it and now it's regex mode.
I find
(http.*)\{\.uri\}
and replace to
[$1]($1)

Juste to update #speedogoo's answer for future readers, if you do not find the regex mode in the search view, it looks like this:
You can also open it with the shortcut Ctrl+Alt+/ (default).
Note that even ^ and $ are already supported by Atom's find-and-replace.

Related

Intellij Hotkey for marking regex checkbox on search/replace

I have a question that's been bugging me for quite some time now. I'd like to minimize my mouse usage while working in IntelliJ.
When doing searches (ctrl+f) or replacing text (ctrl+r) I always have to manually check the "Regex" checkbox when I want to use regex. Is there a quick way to toggle this checkbox with my keyboard, or do I always have to use my mouse for that?
Simply tabbing to the checkbox does not seem to be an option as using tab simply jumps between the search and replace input-boxes.
I can't seem to find anything in the keymap settings nor on google :(
Thanks in advance. :)
Just hold Alt/Option button to see the mnemonics underscore. In my case I should use Option x to enable Regex.

Using Regular Expressions in Netbeans 8.2 "find & replace"

I am using NetBeans 8.2. I am working in the code editor window and trying to use regex in combination with the NetBeans find/replace feature. I have the regex button turned on.
I am trying this
on this code
specStripWidthUpper: $("#uniflytebundle_quoteitem_QuoteRing_specStripWidthUpper"),
specStripWidthLower: $("#uniflytebundle_quoteitem_QuoteRing_specStripWidthLower"),
The result I would like would take 1st Category found in find regex
specStripWidthUpper
and repeat it on other side of colon ":" like
specStripWidthUpper:specStripWidthUpper
instead it replaces the selection with $1. looking like
specStripWidthUpper:$1,
specStripWidthLower:$1,
Is there a NetBeans setting to run regex for the replace input window or am I doing something incorrect?
Thank you in advance for your time and effort.
Netbeans (8.2?) does not like the lookarounds. I do not know if this is a new thing but you can get around it with a simplified pattern.
However, your pattern does not capture the part you want to repeat, i.e. specStripWidthUpper (you can see this when you toggle the Select option).
Try it like this:
(\w+)(?:\:)(.*),
$1:$1
You might be required to anchor the query to avoid false positives.

Does Adobe Brackets maintain any kind of history of search and replace expressions?

Just now I was working on a fancy search and replace regular expression.
It looked good so I tested it on one entry then went to the editing area and the search and replace box went away.
I reopened the search and replace box to continue, but the selected text in the edit window replaced my search expression.
Control Z in the search box did not go back to my regex but undid the last change in the editing area.
I can't seem to find a way to get back to previous regexes in the find box. Is there any way? Googling turned up nothing.
Currently, Adobe Brackets doesn't maintain any kind of history of search and replace expressions. The feature is still missing.

notepad ++ replacement expression

Hi guys I really need some help, I need to do a mass replace expression in files
I have a large list of urls which needs to be replaced.
I want to search files and replace each with the appropriate brand anchor link e.g.
http://www.example.com
becomes
<a href=”http://www.example.com”> http://www.example.com</a>
I need to do this with a large list of urls in multiple files
I tried the following expression
(1)|(2)|(3)
(?1a)(?2b)(?3c)
But It doesn’t work. This is beyond me. Any help would be appreciated. Thanks
Go to Search > Replace menu (shortcut CTRL+H) and do the following:
Find what:
http:\/\/www\.\w+\.com
Replace:
$0
Select radio button "Regular Expression"
Then press Replace All in All Opened Documents
You can test it and see the results at regex101.
Important note: matching URLs with regular expressions can be complicated! I gave you the simplest example matching only URLs like http://www.example.com. If you have more complicated stuff, let us know but showing some of your data! More info on this matter here and here.
UPDATE:
Let's make it slightly more complicated to match also
yoursite.com/index.php?remainingurl
Find what:
(?:https?:\/\/)?(?:www\.)?(\w+\.\w{2,6})(?:\/\w+\.\w+(?:\?\w+)?)?\b
Replace:
$1

How do I do a regex search and replace in sublime text 2?

I want to remove inline style from an html document in ST2.
I imagine my regex will be something like this
style=\"*\"
If that's wrong, it doesn't matter. I'm sure I'll figure out the expression I'll need.
What I haven't been able to figure out, is how to actually use a regex to find or to find and replace text in ST2. The docs say that it can be done. But I can't find the documentation for how to do it.
Simply open the Search+Replace function (via Ctrl-H or the menu bar) and check the first box on the left of it (the one with an '*' on it, or you can press Alt+R)
Then the search field will be used as a Regex, and you can use the found patterns using the usual $1, $2, $3 vars in the replace box
More info here
I had a similar task to perform, the regex I used in the manner that Nas62 suggested was
style=\"(.*?)\"
Find What : style=".*" Replace With : leave it as blank
Click Replace All button.