Replacing string if it contains specified pattern

vernol

I need to replace [email protected]| or sam[email protected]| to

''(empty strings).I have written following regex but its unable to deal

with . - emptyspace in the strings.

my regex is \[email protected]["|"]

now question is how to include ., empty space,- along with alpha numeric characters

my final output should be : [email protected]| to ``

The fourth bird

Add the character you want to match in a character class [\w.-].

In you example you want to match piramal and in your regex you want to match ongoose. To match both of them you might use an alternation (?:ongoose|piramal) or match any non whitespace character using \S+ and replace with an empty string.

To match a dot you have to escape it \.

[\w.-]+@\S+\.com\|

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Replacing a pattern with a string

From Dev

shell test whether multiple lines string contains specified pattern in last line

From Dev

Split String in java by specified pattern

From Dev

If string contains certain pattern then do

From Dev

String#contains using Pattern

From Dev

Check if string contains the same pattern

From Dev

Is it worth it to check if a string contains a substring before replacing it?

From Dev

XPath/XQuery Regular Expression replacing a String pattern

From Dev

Pattern Replacing in string with escaped characters failing with replaceAll

From Dev

Delphi - How to check if a listBox contains specified string?

From Dev

Scala string that contains at most specified characters

From Dev

Hide table row that contains specified string

From Dev

Shell : Checking if a string contains a specified character

From Dev

Select element whose child/grandchildren/.. contains an element with a specified pattern

From Dev

Select element whose child/grandchildren/.. contains an element with a specified pattern

From Dev

how to rename multiple files by replacing string in file name? this string contains a "#"

From Dev

Remove specified pattern from string in R

From Dev

Remove specified pattern from string in R

From Dev

Replacing different string with different new string that follows a pattern

From Dev

Replacing one character in string with another string excluding pattern

From Dev

Javascript for regex to check for not contains with the starting with the string pattern

From Dev

How to split string contains same pattern

From Dev

Issue with Java string search pattern ( contains / matches)

From Dev

Regex to match any string that contains pattern 2.4.2

From Dev

Pattern to check if a string contains specific characters

From Dev

How to split string contains same pattern

From Dev

Filter Replace string that contains given pattern

From Dev

Replacing all occurrences of a string that contains special chars in javascript

From Dev

Notepad++ Replacing strings in a line after a line that contains string

Related Related

  1. 1

    Replacing a pattern with a string

  2. 2

    shell test whether multiple lines string contains specified pattern in last line

  3. 3

    Split String in java by specified pattern

  4. 4

    If string contains certain pattern then do

  5. 5

    String#contains using Pattern

  6. 6

    Check if string contains the same pattern

  7. 7

    Is it worth it to check if a string contains a substring before replacing it?

  8. 8

    XPath/XQuery Regular Expression replacing a String pattern

  9. 9

    Pattern Replacing in string with escaped characters failing with replaceAll

  10. 10

    Delphi - How to check if a listBox contains specified string?

  11. 11

    Scala string that contains at most specified characters

  12. 12

    Hide table row that contains specified string

  13. 13

    Shell : Checking if a string contains a specified character

  14. 14

    Select element whose child/grandchildren/.. contains an element with a specified pattern

  15. 15

    Select element whose child/grandchildren/.. contains an element with a specified pattern

  16. 16

    how to rename multiple files by replacing string in file name? this string contains a "#"

  17. 17

    Remove specified pattern from string in R

  18. 18

    Remove specified pattern from string in R

  19. 19

    Replacing different string with different new string that follows a pattern

  20. 20

    Replacing one character in string with another string excluding pattern

  21. 21

    Javascript for regex to check for not contains with the starting with the string pattern

  22. 22

    How to split string contains same pattern

  23. 23

    Issue with Java string search pattern ( contains / matches)

  24. 24

    Regex to match any string that contains pattern 2.4.2

  25. 25

    Pattern to check if a string contains specific characters

  26. 26

    How to split string contains same pattern

  27. 27

    Filter Replace string that contains given pattern

  28. 28

    Replacing all occurrences of a string that contains special chars in javascript

  29. 29

    Notepad++ Replacing strings in a line after a line that contains string

HotTag

Archive