JayDeep Nimavat
JayDeep Nimavat

Reputation: 476

I want to replace string with particular format?

I have

active#100,200#
activea#89,2656#
date 10/2/2014

I need output like

active
activea
date 10/2/2014

I write for this

$value2=preg_replace("#","",$value);
$value2=preg_replace("/[0-9,]+/","",$value2);

but in this case it removing date digit also I want to remove just #anyno,anyno# value from above.

How can I do this?

solution accepted.

thanks in advance.

Upvotes: 0

Views: 40

Answers (2)

wrivas
wrivas

Reputation: 509

Try this:

$value1 = preg_replace('/#.+#/','',$value1);

Upvotes: 1

zogby
zogby

Reputation: 482

$value2=preg_replace("/#(.*?)#/","",$value);

Upvotes: 0

Related Questions