I have a very simple textbox given to a user.
<textarea name="text">ENTER YOUR TEXT, DUDE!</textarea>
Sometimes, users could input something like this:
blablablatext blablabla $ 10 blablabla blablablatext
Which is fine but what I want to do is take the dollar symbol and automatically place it after the number (or vice versa):
blablablatext blablabla 10 $ blablabla blablablatext
Basically, what I want to do is:
- Detect if there is a currency symbol
- Detect if numbers appear right after the symbol
- Detect if, for example, a letter (or nothing) appears right after the numbers
- Take the currency symbol and place it inbetween the numbers and letters (or just after the numbers if there is nothing afterwards)
What is the best way to do it? Is something like that possible?