Adding strings in lines (regex notepad plusplus) - regex

I've seen people asking stuff related to regex and i thought id ask my quesstion. I have a file with many lines like this:
374327711199385
and I need to make it to this per each line:
3743-277111-99385
It's a big file so can't do it manually. Any ideas on how to make it automatic with regex? Thanks so much!

To perform this, you need to search with this expression:
^(\d{4})(\d{6})(\d{5})$
And replace with this:
$1-$2-$3

Related

Notepad++ Regex How to add a number at the end of specific lines?

Can anyone help me with a little problem?
I have a lot of lines and they all look like this: sample_text="value". And I need to find all of those lines and add a zero to the end of every value.
For example, I need this:
sample_text="20"
sample_text="45"
to become this:
sample_text="200"
sample_text="450"
I tried looking for ([0-9]{2}) and replacing it with \10 but it also replaces values for different lines and I cannot figure out how to filter it to replace the values that only come after sample_text= and leave everything else the same.
Edit: Never mind, I'm just an idiot. It never occurred to me that I can just search for sample_text="([0-9]{2}) and replace it with sample_text=\10
You can search for "+\r\n then replace it with 0"\r\n

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++ Wildcard Find/Replace

I'm using Notepad++ and need to update a file where there are various differences in earlier sections of the string of text and think Wildcards may help here. From the research I've done thus far, it isn't clear what syntax would be used for this.
Here's an example of the original string:
"EEID","SUPLIFE","Voluntary Life Insurance","500000.00","500000.00",0,276,10.62.0,0,0,"20151112","","A","","","","",""
I'd like to find a way to add wildcards in the places noted below as WILDCARD:
"EEID","SUPLIFE","Voluntary Life Insurance","WILDCARD","WILDCARD",WILDCARD,WILDCARD,WILDCARD,WILDCARD,WILDCARD,WILDCARD,"20151112","","A","","","","",""
The final output would then look like the following after the find/replace with wildcards to add VLIFE:
"EEID","SUPLIFE","Voluntary Life Insurance","500000.00","500000.00",0,276,10.62.0,0,0,"20151112","","A","VLIFE","","","",""
Thanks,
Brandon
Tested in Notepad++ and appears to work:
("EEID","SUPLIFE","Voluntary Life Insurance",([^,]+,){8}"","A",)("")(.*)
and replace pattern:
\1"VLIFE"\4
Regex101 example

Textmate Regex Issue

I have a very large .CSV document with text I need removing. The data looks like this
774431994&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774431994
774431996&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774431996
774431998&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774431998
774432000&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774432000
774432003&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774432003
774432006&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774432006
774432009&images=774431994,774431996,774431998,774432000,774432003,774432006,774432009&formats=0,0,0,0,0 /1/6/9/5/2/6/8/webimg/774432009
I'm using the following Regex which is working on http://regexr.com/3a6oa
/.{128}(?=webimg).{10}/g
It just doesn't seem to work with Textmate Search. Does anyone know why? I need to select all of this junk and replace it with nothing, the numbers are unique each time.
Thanks very much
Why are you using a lookahead in your pattern? Just use: /.{128}webimg.{10}/g
Why are you using Textmate search at all? I'd need to know more context of the problem to say for sure, but I bet a simple sed command could just be used instead:
sed -i "webimg/d" ./filename.csv

Searching my code with regex

It happens all the time, I would need to scan my code for places where I have two or more of the same keywords.
For example $json["VALID"]
So, I would need to find json, and VALID.
Some places in the code may contain:
// a = $json['VALID']; // (note the apostrophes)
(I am using EditPlus which is a great text editor, letting me use regex in my searches)
What would be the string in the regex to find json and VALID (in this example) ?
Thanks in advance!
Use this regex:
\$json\[["']VALID['"]\]
wound find $json<2 character>VALID
\$json.{2}VALID