Sublime text regex - remove text in parenthesizes [duplicate] - regex

This question already has answers here:
My regex is matching too much. How do I make it stop? [duplicate]
(5 answers)
How can I remove text within parentheses with a regex?
(9 answers)
Closed 4 years ago.
I am having list on telephone numbers in my js file, and some of them have in parenthesizes translations that I don't need:
Azerbaijan (Azərbaycan)
I wont to find regex in sublime to do that, but I cannot find the right command. I have tried:
((.))
((*))
\(.*)\
\(.*\)
But I aways remove something different ... If someone know the solution, please help.

Ok as Paul Bak said the (.*) works at his computer, and it does work, just that my js file is compressed all in same line so it removes everything after the (...
I beautified js and use this regex and now it is solved.

Related

Match rest of string with Regex in Notepad++ [duplicate]

This question already has answers here:
How to remove everything after a certain character? (notepad++)
(2 answers)
Closed 3 years ago.
I have the following json file:
[{"accountId":"fe1a8715-794b-4fd9-84df-ccbc7dd1c0c6","id":"9314c53324","state":"Processed","moderationState":"OK","reviewState":"None","privacyMode":"Private","processingProgress":"100%","failureCode":"None","failureMessage":"","externalId":null,"externalUrl":null,"metadata":null,"insights":{"version":"1.0.0.0","duration":"0:00:20.6","sourceLanguage":"en-US","sourceLanguages":["en-US"],"language":"en-US","languages":["en-US"],"labels":[{"id":1,"name":"outdoor","language":"en-US","instances":[{"confidence":0.9964,"adjustedStart":"0:00:00","adjustedEnd":"0:00:04.266","start":"0:00:00","end":"0:00:04.266"},{"confidence":0.9981,"adjustedStart":"0:00:04.267","adjustedEnd":"0:00:10.666","start":"0:00:04.267","end":"0:00:10.666"},{"confidence":0.9966,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:17.066","start":"0:00:10.667","end":"0:00:17.066"},{"confidence":0.969,"adjustedStart":"0:00:17.067","adjustedEnd":"0:00:20.6","start":"0:00:17.067","end":"0:00:20.6"}]},{"id":2,"name":"mountain","referenceId":"geological formation/natural elevation/mountain","language":"en-US","instances":[{"confidence":0.9574,"adjustedStart":"0:00:00","adjustedEnd":"0:00:04.266","start":"0:00:00","end":"0:00:04.266"},{"confidence":0.99,"adjustedStart":"0:00:04.267","adjustedEnd":"0:00:10.666","start":"0:00:04.267","end":"0:00:10.666"},{"confidence":0.9797,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:17.066","start":"0:00:10.667","end":"0:00:17.066"}]},{"id":3,"name":"snow","referenceId":"natural phenomenon/weather/snow","language":"en-US","instances":[{"confidence":0.9755,"adjustedStart":"0:00:00","adjustedEnd":"0:00:04.266","start":"0:00:00","end":"0:00:04.266"},{"confidence":0.998,"adjustedStart":"0:00:04.267","adjustedEnd":"0:00:10.666","start":"0:00:04.267","end":"0:00:10.666"},{"confidence":0.991,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:17.066","start":"0:00:10.667","end":"0:00:17.066"},{"confidence":0.9788,"adjustedStart":"0:00:19.2","adjustedEnd":"0:00:20.6","start":"0:00:19.2","end":"0:00:20.6"}]},{"id":4,"name":"nature","referenceId":"nature","language":"en-US","instances":[{"confidence":0.9946,"adjustedStart":"0:00:00","adjustedEnd":"0:00:04.266","start":"0:00:00","end":"0:00:04.266"},{"confidence":0.9959,"adjustedStart":"0:00:04.267","adjustedEnd":"0:00:10.666","start":"0:00:04.267","end":"0:00:10.666"},{"confidence":0.9792,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:17.066","start":"0:00:10.667","end":"0:00:17.066"},{"confidence":0.8443,"adjustedStart":"0:00:17.067","adjustedEnd":"0:00:19.2","start":"0:00:17.067","end":"0:00:19.2"}]},{"id":5,"name":"valley","language":"en-US","instances":[{"confidence":0.8591,"adjustedStart":"0:00:00","adjustedEnd":"0:00:04.266","start":"0:00:00","end":"0:00:04.266"},{"confidence":0.9502,"adjustedStart":"0:00:04.267","adjustedEnd":"0:00:10.666","start":"0:00:04.267","end":"0:00:10.666"},{"confidence":0.9092,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:17.066","start":"0:00:10.667","end":"0:00:17.066"}]},{"id":6,"name":"canyon","referenceId":"geological formation/natural depression/canyon","language":"en-US","instances":[{"confidence":0.8353,"adjustedStart":"0:00:06.4","adjustedEnd":"0:00:08.533","start":"0:00:06.4","end":"0:00:08.533"}]},{"id":7,"name":"covered","language":"en-US","instances":[{"confidence":0.8697,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:14.933","start":"0:00:10.667","end":"0:00:14.933"}]}],"scenes":[{"id":1,"instances":[{"adjustedStart":"0:00:00.4","adjustedEnd":"0:00:20.6","start":"0:00:00.4","end":"0:00:20.6"}]}],"shots":[{"id":1,"tags":["Outdoor"],"keyFrames":[{"id":1,"instances":[{"thumbnailId":"a137ab2a-f250-4ace-a71f-8a158517863b","adjustedStart":"0:00:00.4","adjustedEnd":"0:00:00.467","start":"0:00:00.4","end":"0:00:00.467"}]},{"id":2,"instances":[{"thumbnailId":"52d41f10-20e7-40c4-9426-d2482fd6ec71","adjustedStart":"0:00:16.667","adjustedEnd":"0:00:16.734","start":"0:00:16.667","end":"0:00:16.734"}]}],"instances":[{"adjustedStart":"0:00:00.4","adjustedEnd":"0:00:20.6","start":"0:00:00.4","end":"0:00:20.6"}]}],"blocks":[{"id":0,"instances":[{"adjustedStart":"0:00:00","adjustedEnd":"0:00:20.6","start":"0:00:00","end":"0:00:20.6"}]}],"textualContentModeration":{"id":0,"bannedWordsCount":0,"bannedWordsRatio":0,"instances":[]},"statistics":{"correspondenceCount":0,"speakerTalkToListenRatio":{},"speakerLongestMonolog":{},"speakerNumberOfFragments":{},"speakerWordCount":{}}},"thumbnailId":"116bfb86-5a32-41a3-9fda-2417beb52a18","detectSourceLanguage":false,"languageAutoDetectMode":"None","sourceLanguage":"en-US","sourceLanguages":["en-US"],"language":"en-US","languages":["en-US"],"indexingPreset":"Default","linguisticModelId":"00000000-0000-0000-0000-000000000000","personModelId":"00000000-0000-0000-0000-000000000000","isAdult":false,"publishedUrl":"https://rodmandev.streaming.mediaservices.windows.net/0c4d34a3-4415-4f56-a4e5-7b34292eb72d/DJI_0043mp4.sil.ism/manifest(encryption=cbc)","publishedProxyUrl":null,"viewToken":"Bearer=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIyNWI5OTRiOC03NzQyLTQ2MmUtOWExMy0zMTYwMzMwNWQzOGQiLCJuYmYiOjE1NzY1MDQxNTUsImV4cCI6MTU3NjU0NzQxNSwiaXNzIjoiaHR0cHM6Ly9icmVha2Rvd24ubWUiLCJhdWQiOiJCcmVha2Rvd25Vc2VyIn0.KAvVIh7dlFqbELqv2wwHJZocHonIXOZCvff20t3KWKg"}]
I'm trying to remove all the text except the words in quotes that come after "name".
In Notepad++, using the find and replace function, I searched for .+?name":"(.+?)" and replaced it with \1.
That returns the following result:
outdoor mountain snow nature valley canyon covered ,"language":"en-US","instances":[{"confidence":0.8697,"adjustedStart":"0:00:10.667","adjustedEnd":"0:00:14.933","start":"0:00:10.667","end":"0:00:14.933"}]}],"scenes":[{"id":1,"instances":[{"adjustedStart":"0:00:00.4","adjustedEnd":"0:00:20.6","start":"0:00:00.4","end":"0:00:20.6"}]}],"shots":[{"id":1,"tags":["Outdoor"],"keyFrames":[{"id":1,"instances":[{"thumbnailId":"a137ab2a-f250-4ace-a71f-8a158517863b","adjustedStart":"0:00:00.4","adjustedEnd":"0:00:00.467","start":"0:00:00.4","end":"0:00:00.467"}]},{"id":2,"instances":[{"thumbnailId":"52d41f10-20e7-40c4-9426-d2482fd6ec71","adjustedStart":"0:00:16.667","adjustedEnd":"0:00:16.734","start":"0:00:16.667","end":"0:00:16.734"}]}],"instances":[{"adjustedStart":"0:00:00.4","adjustedEnd":"0:00:20.6","start":"0:00:00.4","end":"0:00:20.6"}]}],"blocks":[{"id":0,"instances":[{"adjustedStart":"0:00:00","adjustedEnd":"0:00:20.6","start":"0:00:00","end":"0:00:20.6"}]}],"textualContentModeration":{"id":0,"bannedWordsCount":0,"bannedWordsRatio":0,"instances":[]},"statistics":{"correspondenceCount":0,"speakerTalkToListenRatio":{},"speakerLongestMonolog":{},"speakerNumberOfFragments":{},"speakerWordCount":{}}},"thumbnailId":"116bfb86-5a32-41a3-9fda-2417beb52a18","detectSourceLanguage":false,"languageAutoDetectMode":"None","sourceLanguage":"en-US","sourceLanguages":["en-US"],"language":"en-US","languages":["en-US"],"indexingPreset":"Default","linguisticModelId":"00000000-0000-0000-0000-000000000000","personModelId":"00000000-0000-0000-0000-000000000000","isAdult":false,"publishedUrl":"https://rodmandev.streaming.mediaservices.windows.net/0c4d34a3-4415-4f56-a4e5-7b34292eb72d/DJI_0043mp4.sil.ism/manifest(encryption=cbc)","publishedProxyUrl":null,"viewToken":"Bearer=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiIyNWI5OTRiOC03NzQyLTQ2MmUtOWExMy0zMTYwMzMwNWQzOGQiLCJuYmYiOjE1NzY1MDQxNTUsImV4cCI6MTU3NjU0NzQxNSwiaXNzIjoiaHR0cHM6Ly9icmVha2Rvd24ubWUiLCJhdWQiOiJCcmVha2Rvd25Vc2VyIn0.KAvVIh7dlFqbELqv2wwHJZocHonIXOZCvff20t3KWKg"}]
The problem is that I don't want to keep any text after covered.
I tried using .+?name":"(.+?)"(\S+) which removed some of the text I want to keep.
How do I fix this?
You should search using a pattern which targets the entire file:
Find: ^.*"name":"(.+?)".*$
Replace: $1
What is currently happening is that your pattern only targets everything up to the literal in quotes appearing after the key name. The content after that is not being replaced.
Demo

how to remove dublicate proxies in list? [duplicate]

This question already has answers here:
Removing duplicate rows in Notepad++
(17 answers)
Closed 3 years ago.
i have a proxy list like this :
5.5.5.5:62359
4.4.4.4:95684
6.6.6.6:65419
4.4.4.4:95684
7.7.7.7:65487
now i want to convert top list to this :
5.5.5.5:62359
4.4.4.4:95684
6.6.6.6:65419
7.7.7.7:65487
--> i want to remove dublicate proxies in list
are there any website or program or notepad++ regex that do this ?
It's very easy to do it in sublime text. just open the file and eidt -> permute lines -> unique
You may find the answer here. But it will not work without sorting alphabetically.
Search
^(.*)(\r?\n\1)+$
Replace
\1
The find and replace with regex function worked on Notepad++.
But, it doesn't work on visual studio code.

regex matching when not trailing slash [duplicate]

This question already has answers here:
How do I recognize strings that do not end with a slash character ('/') using a regex?
(3 answers)
Closed 4 years ago.
How would a regex look like when i have the input
foo.bar/level/1A
foo.bar/level/1A/test
foo.bar/level/1B
foo.bar/level/1A/blabl/sdffs
foo.bar/test
As a result I only want the urls where the root items in the level folder so
foo.bar/level/1A
and
foo.bar/level/1B
So anything in the level folder that is nog followed by a slash basicly
What is the best regex way to extract these ?
Thx (I realy need to find a good regex training cause I always bump into this stuff when there is look ahead / back and stuff involved)
You can use:
^[^\/]*\/level\/[^\/]*$
Demo: https://regex101.com/r/iqnsjV/1

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\]

regular expression find all the http within [test](http://) [duplicate]

This question already has answers here:
My regex is matching too much. How do I make it stop? [duplicate]
(5 answers)
Closed 6 years ago.
I have tried hrs for this regex and couldn't sort it out, and seek for some help.
/\[.*\]\((https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g
Here is the link to my regex page link
https://regex101.com/r/Xc5zDp/1
I try to pick out all the links in the sentence and example like this [link](http://test.com), but it keep select both links all together
Simplify your regex to this: \[.*?\)
Is this what you want? Demo