Welcome to WebmasterWorld Guest from 54.196.244.45

Forum Moderators: open

Message Too Old, No Replies

Regular Expressions & Math Operations

     
10:13 pm on Jan 25, 2007 (gmt 0)

New User

5+ Year Member

joined:Sept 22, 2006
posts:3
votes: 0


Is there a way to perform math operation using regular expressions?
I use HomeSite, and using Extended replace with Regular Expressions, I am able to locate/replace a code, but can not find how to perform math operations on the found code.

Okay, let me explain this better. What i'm trying to do is using Extended replace find prices on my pages and do some math operations with them. So far using extended replace i can find the prices, but how do i perform math operations on them. is this possible?

I use the following RegEx to locate the code:
Price ([$][0-9.]*)
but can not do this for example
/1 * 2 , i want to simply take the value stored in the first variable and multiply it by 2.

Any help would be greatly appreciated.

11:15 pm on Feb 12, 2007 (gmt 0)

Full Member

5+ Year Member

joined:Jan 17, 2007
posts:306
votes: 0


You can't do that with RegEx. You need some other programming language to manipulate the match(es), such as Javascript, VB or PHP.