C# Regex Replace string with Ignore specific word [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 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

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.

A simple regex call to replace some text in Eclipse [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
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

i want to parse a string between two -'s by using regexp [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 8 years ago.
Improve this question
i want to parse the values between -. but for some data like 1st url contains -- so in that case i need to get the gap only and the next one i am able to get **camry** successfully by using *(site_data,'[^-]+',1,2)*. but i want to handle the gap as well.
U=Google--undefined|http://www.google.com/urlsa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=2&ved=0CFMQFjAB&url=http://www.toyota.com/tundra/features.html&ei=-zwQUvOyGIXu2QWC7oGgBg&usg=AFQjCNFQKGcr2dbDeC-0zagtYdKFEfXXzQ&bvm=bv.50768961,d.aWc
U=Bing-camry-undefined|http://www.bing.com/searchq=camry&pc=MOZI&form=MOZSBR
Please help on this.
You can extract the string along with the hyphens, and then trim the hyphens.
trim('-' from regexp_substr(site_data,'-[^-]*-'))
Alternatively, you can also use regexp_replace function.
regexp_replace(site_data,'(-([^-]*)-)|(.)','\2')

how to get first word after phrase with regex [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
How do you find the first word after a string literal via regex?
I.e.
I want to extract "DAQJ7PS" from the line:
ERROR service.PostService - Failed to save post DAQJ7PS
/ERROR service\.PostService - Failed to save post (.+)/
will give you the result in the first capturing group. This can be tuned if you have more specific requirements.