MeridianManagement
asked on
A couple simple perl compatible regular expressions using php's preg_replace function.
Part 1
Okay, I'm trying to wipe out all dollar values from a string. It's driving me insane. I have no idea what I'm doing...
I tried.. $html = preg_replace("\$[0-9]+.[0] [0]",'',$h tml);
Please help!
<td>PKG</td><td>Sport Lite Package (1 @ $254.00)</td><td align="right">$254.00</td>
Part 2.
$4,543.00 AVS85X17DS2
$4,917.00 AVS85X17DS2
$4,543.00 AVS85X17DS2
$21,896.00 EG85X28WT4
$6,390.00 KLS7X20WT3
$4,723.00 RT7X16WT2
I'm looking to extract sizes from the top... I don't exactly know what to do... but here are the real values I'm trying to extract
85X17
85X17
85X17
85X28
7X20
7X16
It seems like the sizes are surrounded by alpha.
Okay, I'm trying to wipe out all dollar values from a string. It's driving me insane. I have no idea what I'm doing...
I tried.. $html = preg_replace("\$[0-9]+.[0]
Please help!
<td>PKG</td><td>Sport Lite Package (1 @ $254.00)</td><td align="right">$254.00</td>
Part 2.
$4,543.00 AVS85X17DS2
$4,917.00 AVS85X17DS2
$4,543.00 AVS85X17DS2
$21,896.00 EG85X28WT4
$6,390.00 KLS7X20WT3
$4,723.00 RT7X16WT2
I'm looking to extract sizes from the top... I don't exactly know what to do... but here are the real values I'm trying to extract
85X17
85X17
85X17
85X28
7X20
7X16
It seems like the sizes are surrounded by alpha.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"$text" in the second statement is supposed to be the string containing your data including the data about sizes.
Thanks for the clarification ozo, I'd forgotten about the thousands separators.
Thanks for the clarification ozo, I'd forgotten about the thousands separators.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The output of the above script, when run against your sample data as indicated, is:
85X17
85X17
85X17
85X28
7X20
7X16
85X17
85X17
85X17
85X28
7X20
7X16
ASKER
Thanks everyone! What was actually wrong was the quotation. Php doesn't like double quotes for preg functions. Great job!
ASKER