Link to home
Start Free TrialLog in
Avatar of fidoly
fidoly

asked on

Using Wildcards on replace.

Hello,

I have a problem with the following script:

var str='BEGIN Width="445" Height="445" MIDDLE width="445" height="445" END';
str = str.replace(/width.* /gi, 'width="290" ');
document.write(str);

The result is: BEGIN width="290" END
I would expect the result to be: BEGIN width="290" Height="445" MIDDLE width="290" height="445" END

Any advise please?

Many thanks.
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna 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
Avatar of fidoly
fidoly

ASKER

Excellent!   Thanks a MEG!