A simple regex call to replace some text in Eclipse [closed] - regex

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need help with a really simple regex find/replace command for Eclipse. It'd be great if you could provide me with something to try.
I need to replace all occurrences of the text typeSingleton(*) ), with typeSet({ * } ).

Assume that inside brackets you may have letters, brackets, spaces, then:
Find: typeSingleton\(([a-z ]+(\([a-z ]+\))? ?)\)
Replace: typeSet({$1})
EDIT
Demo: https://regex101.com/r/dD0wK0/1

Related

regex for partial urls [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
does anyone know how to write the regex for this list of urls for workbox
/
/tracker/patientlist
/tracker/visitlist
/tracker/triage
i am new to regex
Assuming you want to match the root url /, or /tracker/*, try this:
/(tracker/\w+)?
Here is one way.(Not sure what other URI variations you may have, but this should do it). If the first part is always /tracker, then use Bohemian's answer.
(\/[a-zA-Z]+)

How to move ip adresses to the end of line in Notepad++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have the data as follows in txt:
136.40.226.97|ubnt|ubnt|
138.197.81.94|listd|54e172662|
138.68.254.243|wordpress|wordpress|
139.162.55.12|public|public|
139.60.58.136|system|OkwKcECs8qJP2Z|
I want to convert it to this:
|ubnt|ubnt|136.40.226.97
|listd|54e172662|138.197.81.94
|wordpress|wordpress|138.68.254.243
|public|public|139.162.55.12
|system|OkwKcECs8qJP2Z|139.60.58.136
In Find and Replace window Ctrl+H change Search Mode to Regular expression and set:
Find what: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(.*)
Replace with: (\2)(\1)
This will find too groups: IP(1), rest of line(2), then Replace writes them in inverted order.

perl nested regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Text record:
(1,2,3,4,{fred,don,max,rat,grp},45,67,mat,jhon,{a,b,1,2,sd[{1,2},{4,5}],45,67,P[{34,56,34},{uni,cast,r}],c{q,ew,3,4},1,2,3,cf{2,4,5,8},6},4,fr{24,45,67},5,NOL)
Desired output:
(1,2,3,4,{fred:don:max:rat:grp},45,67,mat,jhon,{a:b:1:2:sd[{1:2}:{4:5}]:45:67:P[{34:56:34}:{uni:cast:r}]:c{q:ew:3:4}:1:2:3:cf{2:4:5:8}:6},4,fr{24:45:67},5,NOL)
needs to be replace by : for the below:
Everything between {} and []
The data has nested structure like {{}} and {[],[]}
The text record is always between ().
Any help with perl is appreciated.
You may try the below perl command which uses positive lookahead based regex.
perl -pe 's/,(?=(?:\{[^{}]*\}|[^{}])*})|,(?=(?:\[[^\[\]]*\]|[^\[\]])*\])/:/g' file
DEMO

C# Regex Replace string with Ignore specific word [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have File and I want to replace fix character * : ~ with # using regex but, it should not replace(ignore) B~~ word because, it need to remain as it is. Anybody have idea for that?
Input :
ABCHKLJNKL*dskjnsdfkdsmflkmdls
MLKMLKMLKMLKMLKMMML
zlmlkmm:skjnjnskfjnkjsdnkfjnkdjs
B~~KJNNKJNJNKKJNKJNFKKJNJNK
Output Should be :
ABCHKLJNKL#dskjnsdfkdsmflkmdls
MLKMLKMLKMLKMLKMMML
zlmlkmm#skjnjnskfjnkjsdnkfjnkdjs
B~~KJNNKJNJNKKJNKJNFKKJNJNK
Please provide regex because i want to done with one step.
Thanks
[*:]|(?<!B[~])[~](?![~])
Try this.This should do it.See demo.Replace by #.
https://regex101.com/r/tX2bH4/66

Regex to search for everything before a string, and after [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I would like to search for everything before the string http://thepaperwall.com/wallpapers/ but not including that string.
I would also like to search for everything after .jpg but not including .jpg.
So my final string should look like this:
http://thepaperwall.com/wallpapers/cityscape/small/small_642331afcd78d0840485bb352d99b289b50e8467.jpg
How can I do this?
You can use look-behind and look-ahead to get a string position between 2 other strings:
(?<=http://thepaperwall.com/wallpapers/).*(?=\.jpg)
You need a non-capturing group:
(.*)(?:http:\/\/thepaperwall\.com\/wallpapers\/.*\.jpg)(.*)
Live demo