How to remove a pattern from a string using Regex

toosensitive

I want to find paths from a string and remove them e.g. string1 = "'c:\a\b\c'!MyUDF(param1, param2,..) + 'c:\a\b\c'!MyUDF(param3, param4,..)...", I'd like a regex to find the pattern '[some path]'!MyUDF, and remove '[path]'. Thanks

Edit e.g. input string1 ="'c:\a\b\c'!MyUDF(param1, param2,..) + 'c:\a\b\c'!MyUDF(param3, param4,..)"; expected output "MyUDF(param1, param2,...) + MyUDF(param3, param4,...)" where MyUDF is a function name, so it consists of only letters

Anirudha
input=Regex.Replace(input,"'[^']+'(?=!MyUDF)","");

In case if the path is followed by ! and some other word you can use

input=Regex.Replace(input,@"'[^']+'(?=!\w+)","");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Remove regex pattern from string and store in csv

From Dev

How to extract and replace a particular pattern from string using regex?

From Dev

How to extract some words pattern from string using regex in python

From Dev

How to remove specific string from string using regex

From Dev

How to remove the last comma and space from string (if there) using regex?

From Dev

how to remove star * from string using regex in pyspark

From Dev

How to remove timestamp using regex from a date string in javascript

From Dev

Python - Extract pattern from string using RegEx

From Dev

How split a string using regex pattern

From Dev

How to remove a specific pattern from a string in R?

From Dev

How to remove a specific pattern from a string in R?

From Java

Remove pattern from beginning of string using only Bash pattern matching

From Dev

Simple method to remove pattern matching regex from string in Ruby

From Dev

Remove tag from string variable using Regex

From Dev

Remove numbers from beginning of string using regex

From Dev

Remove a href tags from a string using regex

From Dev

Remove tag from string variable using Regex

From Dev

Remove numbers from beginning of string using regex

From Dev

Regex remove pattern from match

From Dev

How to remove duplicate characters in a string using regex?

From Dev

How to remove duplicate characters in a string using regex?

From Dev

How to make a regex to remove a string from text?

From Dev

How to remove line breaks when using Regex Pattern.compile

From Dev

How to remove a text followed by backslash in file using sed or regex pattern

From Dev

How to work with the results from NSRegularExpression when using the regex pattern as a string delimiter

From Dev

Using regex to remove a string

From Dev

Remove a combination of numbers and symbols from a string using the ${VARNAME//pattern/} way

From Dev

How to extract numbers from string using a pattern?

From Dev

Separating a string using a regex pattern

Related Related

  1. 1

    Remove regex pattern from string and store in csv

  2. 2

    How to extract and replace a particular pattern from string using regex?

  3. 3

    How to extract some words pattern from string using regex in python

  4. 4

    How to remove specific string from string using regex

  5. 5

    How to remove the last comma and space from string (if there) using regex?

  6. 6

    how to remove star * from string using regex in pyspark

  7. 7

    How to remove timestamp using regex from a date string in javascript

  8. 8

    Python - Extract pattern from string using RegEx

  9. 9

    How split a string using regex pattern

  10. 10

    How to remove a specific pattern from a string in R?

  11. 11

    How to remove a specific pattern from a string in R?

  12. 12

    Remove pattern from beginning of string using only Bash pattern matching

  13. 13

    Simple method to remove pattern matching regex from string in Ruby

  14. 14

    Remove tag from string variable using Regex

  15. 15

    Remove numbers from beginning of string using regex

  16. 16

    Remove a href tags from a string using regex

  17. 17

    Remove tag from string variable using Regex

  18. 18

    Remove numbers from beginning of string using regex

  19. 19

    Regex remove pattern from match

  20. 20

    How to remove duplicate characters in a string using regex?

  21. 21

    How to remove duplicate characters in a string using regex?

  22. 22

    How to make a regex to remove a string from text?

  23. 23

    How to remove line breaks when using Regex Pattern.compile

  24. 24

    How to remove a text followed by backslash in file using sed or regex pattern

  25. 25

    How to work with the results from NSRegularExpression when using the regex pattern as a string delimiter

  26. 26

    Using regex to remove a string

  27. 27

    Remove a combination of numbers and symbols from a string using the ${VARNAME//pattern/} way

  28. 28

    How to extract numbers from string using a pattern?

  29. 29

    Separating a string using a regex pattern

HotTag

Archive