views:

48

answers:

1

I have data with dates written as 1992.09.02, as an example. If the dates are not available, you end up with 1992.09.?? or 1992.??.?? or otherwise .??.??.?? if no date is known.

I need to change the ".??" to "" ie., nothing.

Here's is my attempt, but I'm not getting anywhere.

$text="^[1-9]. [\.\?\?] ";
str_replace("\.\?\?", " ", "$text");
+5  A: 
$text = str_replace(".??","",$text);
GSto
"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." -- attr. to Jamie Zawinski
zombat
I copied and pasted your code in my php document, and it's not replacing the ".??" when the php doucument is executed. Is there something else I need to do?
ggg
Do I have to define the raw string as a regexp?
ggg
@ggg forget regexp, it's overkill for what you're trying to do.
Ben Rowe
@ggg - is your date variable named `$text`? You should post the relevant code so we can see what's wrong.
zombat