Regular expression to select everything outside <> in a string [duplicate] - regex

This question already has answers here:
Regular expression to extract text between square brackets
(15 answers)
Closed 4 years ago.
I'm not very handy with regex and I need to select everything outside <> to get the length of the string, excluding the "<>".
For example: first<second>third<fourth>fifth should give me first third fifth.
How can I do it? I spent some hours searching the web but I didn't really find what I needed. The regex is needed for use in javascript.

You can always replace the text between smaller than and greater than symbols using regex below.
/<\w+>/g
In this case the text which is outside remains.
See https://regexr.com/422jf

Related

Notepad++ move the end of a line to the front [duplicate]

This question already has answers here:
notepad++ reg expressions to swap two values
(4 answers)
Closed 2 years ago.
I have a csv file with movie data but some of the titles have the starting word at the end of the title for example
281,River Wild, The
282,Time to Kill, A
need to be
281,The River Wild
282,A Time to Kill
For anyone wondering the solution was to use a regular expression
,(.+?), (.+?)$
and the replace with
,$2$1
and click on regular expression and wrap around

Grab a value from a string using Regex [duplicate]

This question already has answers here:
Regular expression to get a string between two strings in Javascript
(13 answers)
Closed 2 years ago.
I have a link that I want to grab a specific character out of. This is the link in question
"https://example.com/example-myexample/from/MyHouse/to/48DFjjhf333333333/view"
I want to grab the following id 48DFjjhf333333333 from this link using a regular expression. In this link /to/ and /view never change. The only thing that ever changes is the id that you see 48DFjjhf333333333.
I've tried the following regular expression:
\/to(.*?)\/view
This grabs everything along with /to/ and /view as follows /to/48DFjjhf333333333/view. I want to grab just the ID itself 48DFjjhf333333333
You just need to access the matching group with [1]
console.log("https://example.com/example-myexample/from/MyHouse/to/48DFjjhf333333333/view".match(/\/to\/(.*?)\/view/)[1])

Regex Extract on Google Sheets [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 3 years ago.
I am trying to find an expression that can be used extract a string after a specific number of characters.
E.g
FR_EN_BR_Student_Exact
FR_EN_NB_Student_Exact
I would want a pattern that can take all characters past the second underscore ( not including the underscore.
Would appreciate any ideas!
I understand basic regex but am having trouble with this specific query.
try:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A, ".+_.+_(.+_.+_.+)")))

Select the second instance of a character with regex [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 3 years ago.
I want to select the second 'M' in the following string using regex.
So, the M after T.
P3Y6M4DT12H30M5S
Sometimes the string looks like one of these:
PT12H30M5S
PT12H30M5.234523S
I've tried multiple expressions and searched for a similar case but couldn't find anything.
Could someone help me build an expression to select the M after T so I can use it in my regex replace function?
(?!.+T.+)(M)
Selects everything until the first T and then selects everything until the first M and captures it.
Example: https://regex101.com/r/sPbQQj/2

Regex help to filter only 720p [duplicate]

This question already has answers here:
What special characters must be escaped in regular expressions?
(13 answers)
Closed 4 years ago.
I'd like to setup auto download of some Anime using an RSS feed, but only 720p versions. The format never changes and it always looks like below.
[Blahblah] Blahepisode - 12 [720p].mkv
Here is the regex I have come up with but cannot get to work properly.
/.\+[720p]+/g
Any help would be appreciated!
Assuming you have lines that look like your example, it will be mached with the following Regex:
.+(?:\[720p\].mkv)
It maches one or more chacacters at start, followed by '[720p].mkv'.
Note that the Square brackets are escaped to '\[' and '\]', otherwise they have special meaning.
if you only need '[720p]' then you can use:
\[720p\]