Notepad++: Capitalize first letter of a word after : in sentence [duplicate] - regex

This question already has answers here:
Notepad++ Capitalize Every First Letter of Every Word
(5 answers)
Closed 10 days ago.
I have data like:
abcd#efg.com:123abcd
abcd#efg.com:1abcd23
abcd#efg.com:abcd123
How can I do to convert first char after ":" to caps, like in example include, that is "a" character
Thanks
I split it to 2 columns, and choice convert 2nd column to Proper Case, but looks like notepad++ don't work

It can be done with find & replace Ctrl+H:
    Find what: (\S#\S*?:.*?)([a-z])
    Replace with: \1\U\2
    ☑ Match case
Search mode:
    ⦿ Regular expression ☐ . matches newline
Replace All

Related

How can I remove a certain pattern from a string? [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 2 years ago.
I have this string like "682_2, 682_3, 682_4". (682 is a random number)
How can i get this string "2, 3, 4" using regex and ruby?
You can do this in ruby
input="682_2, 682_3, 682_4"
output = input.gsub(/\d+_/,"")
puts output
A simple regex could be
/_([0-9]+)$/ and in the match group of the result you will have 2 for 682_2 and 3 for 682_3
Ruby code snippet would be "64532_2".match(/_([0-9]+)/).captures[0]
you can use scan which returns an array containing the matches:
string_code.scan(/(?<=_)\d/)
(?<=_) tells to find a pattern that has a given pattern (_ in this case) before itself but wont capture that, it captures only \d. if it can have more than 1 digit like 682_13,682_33 then \d+ is necessary.

Regex function to find all and only 6 digit numeric string ignoring spaces if any any between [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 3 years ago.
I have HTML source page as text file.
I need to read file and find out only those numeric strings which have 6 continous digits and can have a space in between those 6 digits
Eg
209 016 - should be come up in search result and as 400013(space removed)
209016 - should also come up in search and unaltered as 209016
any numeric string more then 6 digits long should not come up in search eg 20901677,209016#223, 29016,
I think this can be achieved by regex but I was not able to
A soln in regex is more desirable but anything else is also welcome
To match 6 digits with any number of spaces in between, you may use the following pattern:
\b(?:\d[ ]*?){6}\b
Or if you want to reject it when it's followed by an #, you may use:
\b(?:\d[ ]*?){6}\b(?!#)
Regex demo.
Then, you can use the replace method to remove the space characters.
Python example:
import re
regex = r"\b(?:\d[ ]*?){6}\b(?!#)"
test_str = ("209016 \n"
"209 016\n"
"20901677','209016#223', '29016")
matches = re.finditer(regex, test_str, re.MULTILINE)
for match in matches:
print (match.group().replace(" ", ""))
Output:
209016
209016
Try it online.
You can try the following regex:
\b(?<!#)\d(?:\s*\d){5}\b(?!#)
demo: https://regex101.com/r/ZCcDmF/2/
But note that you might have to modify your boundaries if you need to exclude more than the #. it will become something like:
\b(?<!#|other char I need to exclude|another one|...)\d(?:\s*\d){5}\b(?!#|other char I need to exclude|another one|...)
where you have to replace other char I need to exclude, another one,... by the characters.

Removing everyting before first comma and after third comma [duplicate]

This question already has answers here:
Regex - Remove everything before first comma and everything after second comma in line
(3 answers)
Closed 4 years ago.
I have the following text in my notepad++:
14, CANCELLATION,rigtt,14;
192, CERTIFICATE,LatL,192;
32, TARGET, LATP, 32
I want to remove everything before first comma and after third comma so the above will be like this:
CANCELLATION,rigtt
CERTIFICATE,LatL
TARGET, LATP
what regular expression should I use to achieve the above string. I tried *., and that did not work.
any help will be appreciated.
regular expression :
^[^,]*,([^,]*,[^,]*).*$
playground for the above: https://regex101.com/r/puCyO3/2
explanation :
^ scan from the beginning of the string
[^,]*, until the 1st comma
([^,]*, capture up to and including the 2nd comma ...
[^,]*) ... and up to but not including the 3rd comma
.*$ ignoring everything until the end of the string
I'm assuming all the lines have ; at the end.
I would do it in 2 steps.
Use replace all (CTRL+H)
Replace this [0-9],? with nothing
2.Use replace all (CTRL+H)
Replace this , *; with nothing(there is a space between , and *)

Groovy - Extract a string between two different strings [duplicate]

This question already has answers here:
Regex Match all characters between two strings
(16 answers)
Closed 5 years ago.
I have files names in the below format -
India_AP_Dev1.txt
USA_GA_QA2.txt
USA_NY_AWSDev1.txt
AUS_AA_BB_QA4.txt
I want to extract only the environment part from the file name i.e. Dev1, QA2, AWSDev1, QA4etc. How can I go about with this type of file names. I thought about substring but the environment length is not constant. Is it possible to do it with regex
Appreciate your help. TIA
It is definitely possible using lookarounds:
(?<=_)[^._]*(?=\.)
(?<=_) match is preceded by _
[^._] take all characters except . and _
(?=\.) match is followed by .
Demo

Regex find sting in the middle of two strings [duplicate]

This question already has answers here:
What special characters must be escaped in regular expressions?
(13 answers)
Closed 5 years ago.
I want to get the time in the following line. I want to get the string
2017-07-07 08:30:00.065156
in
[ID] = 0,[Time] = 2017-07-07 08:30:00.065156,[access]
I tried this
(?<=[Time] = )(.*?)(?=,)
Where i want to get the string in-between the time tag and the first comma but this doesn't work.
[Time] inside a regex means a T, an i, an m, or an e, unless you escape your square brackets.
You can drop the reluctant quantifier if you use [^,]* in place of .*:
(?<=\[Time\] = )([^,]*)(?=,)