Link to home
Start Free TrialLog in
Avatar of karthikramanathan
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.
Avatar of karthikramanathan
karthikramanathan

ASKER

In short, I need a regular expression for this string:

'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_%';
SOLUTION
Avatar of TeRReF
TeRReF
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial