How to do RegEx search in Atom text editor - regex

I was just wondering, how can you properly do a RegEx search in atom or any other text editors?
I have a text file with lots of lines like this:
<parentId>1B2FC8AD-C8E4-49F3-BB75-8F306C562B27</parentId>
I am trying to find all of those lines, and replace the uniqueID with one uniform uniqueID for all, so I am planning to do a search and global replace, but not sure what to put in the "find" area.
I attempted a regex search using <parentId><.*></parentId>, but to no avail.
Any help would be appreciated.
Thanks!

Here is one way to do it:
Regular Expression: ^<parentId>.*</parentId>$
Replace with: your new id

Related

VS Code, find/replace access find results in the replace field

I have phone numbers on my file and I would like to surround each of them with braces, so if I have this:
"+49-1111"
"+49-2222"
I would like to run a replace operation and to get this:
["+49-1111"]
["+49-2222"]
Is that possible with the current vs code find/replace action?
If it is a dup sorry but I could find any explanation anywhere.
Thanks
This is more relevant to regular expression.
Find ("\+\d{2}-\d{4}"), replace the occurrences with [$1]
Be sure to turn the "Use Regular Expression" switch on.

Regex Find and Replace using line numbers condition in editplus

I have a huge text file with over 20K lines of content. I am using editplus 4.0 version to achieve my desired result.
What I want to do is;
I want to insert/append a keyword, randomly in the content. Now, the condition is, I want to insert my keyword once for every 60 lines.
If I achieve this, next I have another app which can split my huge content into multiple lines based on line count, which is 60 in this case.
So, end of the day I will have my content into multiple text files and every file includes my keyword which I am going to use it for blog posting.
Please suggest me if I can do this with editplus, other ways of achieving the same will also welcome.
I tried lot of options but no luck.
Thanks in advance !!
AFAIK editplus doesn't work with regex.
I suggest you to use Notepad++, with it you can do:
Ctrl+H
Find what: ((?:[^\r\n]*\R){60})
Replace with: $1KEYWORD\n
Replace all
Don't forget to select Regular expression in search mode.

Notepad++ switch postions with regex

Hello I need a help with my text which is like this
Text1|Text2|Text3|Text4|Text5|Text6|Text7|Text8|Text9|Text10
So the text need to change it to like this:
Text8|Text5|Text4|Text9|Text10|Text7
So change these texts postions and remove Text 1,2,3,6
With regex you can use capture groups to replace stuff. In your case it might look like
find
(Text1)\|(Text2)\|(Text3)\|(Text4)
replace
$2|$1|$4|$3
will result in
Text2|Text1|Text4|Text3
So just apply this technique to your longer string and it should work just fine. Assuming you know how to order the results.

Regex find text between two hash comments

I want to find and replace text between to hash comments. e.g I want to find if there is a text something like below within #string_start and #string_end
#string_start
this could be any text here
and here
#string_end
I tried this code but it didn't work and I know I am not using the corrent syntax due to my lack of regex knowledge.
\#string_start(.*?)\#string_end
#string_start\n([\s\S]*?)#string_end
Try this.Grab the capture.See demo.
https://regex101.com/r/vD5iH9/61

Find and Replace using RegEx in SublimeText but just add formating

Using sublime text to find a model number in sublime text. I can find the regular expression but I want to add some formatting to what it finds. For Example, a model number may be
J627TS4
but then I want to do a find and replace and make it into.
J627TS4
Is this possible in SublimeText. I have to add it to 300+ models on a chart and I am looking for an easier way. Thanks!
Try this:
Find:
([A-Z]\d{3}[A-Z]{2}\d)
Replace
$1