Remove specific pattern from string

Ayman Hussein

I have an example string of "welcome to my home page (23) | Ayman". I need to remove (23) from this string. Note, that 23 is used only as example and can have any value in this place.

I tried this code:

$str = preg_replace("\(d)/", " ", $str);

But, it is not working as expected.

Girish

Try the code:

$str =  "welcome to my home page (23) | Ayman";
echo preg_replace("/\(\d+\)/", "", $str);

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 specific pattern from string

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 Dev

Pattern Remove from string php

From Dev

SED: remove pattern from two specific lines

From Dev

SED: remove pattern from two specific lines

From Dev

bash : Remove the specific pattern of characters from a line

From Dev

How to remove a specific pattern from a file

From Dev

Remove a string pattern and symbols from string

From Dev

Remove specific char from String

From Dev

remove specific word from string

From Dev

Remove specific characters from a string

From Dev

Remove specific characters from a string

From Dev

Remove specific image from a string

From Dev

remove specific characters from a string

From Dev

Remove specific string from file

From Dev

Remove specified pattern from string in R

From Dev

How to remove a pattern from a string using Regex

From Dev

Remove substring/pattern word from a string

From Dev

Remove substring/pattern word from a string

From Dev

Remove regex pattern from string and store in csv

From Dev

Remove specified pattern from string in R

From Dev

Extract a specific text pattern from a string

From Dev

Remove specific string from string input in PHP

From Dev

how to remove specific String from String in java

From Dev

Remove specific string from string input in PHP

From Java

Remove pattern from beginning of string using only Bash pattern matching

From Dev

R: How to remove a string containing a specific character pattern?

From Dev

Splitting String in specific pattern and remove the last digit in groovy

Related Related

HotTag

Archive