Hi all

After many years of head-scratching trying to get to grips with Regular Expressions, I've come to a point in a project where I must utilise their power but I'm hitting brick walls already.

I've writing a typography parser to convert standard keyboard-inputted characters into their typographical counterparts (quotation marks into curly quotes, proper Em and En dashes, etc.). I think I can identify characters based on patterns but I can't properly replace them.

For example, I want to change a standard keyboard dash (the one paired with the underscore) into an Em dash when it's sandwiched between two numbers. Let's say we have in our string

45-78

I can successfully identify that dash with the pattern

[0-9]-[0-9]

but the string returned will be

5-7

so when I go to replace with my Em dash, it replaces the whole found string, not just the dash, giving

4—8

when I want

45—78

Obviously there's something big time I'm missing, or is my pattern incorrect? I want to identify a dash that is preceded and succeeded by a number, and change the dash only.

Any help out there?

MOU

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to