karthikramanathan
asked on
Regular expression question
Hi,
$str1 = 'some_text_1_' . time() . '_end';
$str2 = 'some_text_103_' . time() . '_end2';
With a regular expression, I want to replace the *value* of time() in $str1 and $str2 with some other string. For example, I want the result as:
$str1 = 'some_text_1_NEW_end';
$str2 = 'some_text_103_NEW2_end2';
Please help.
$str1 = 'some_text_1_' . time() . '_end';
$str2 = 'some_text_103_' . time() . '_end2';
With a regular expression, I want to replace the *value* of time() in $str1 and $str2 with some other string. For example, I want the result as:
$str1 = 'some_text_1_NEW_end';
$str2 = 'some_text_103_NEW2_end2';
Please help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
'some_text_*_#_%';
where:
* denotes a numeric entry,
# denotes the value of time(), and
% is some string
Neither of these symbols can be empty. I want to replace the # with some string. The result should be:
'some_text_*_NEW_%';