Jump to content

Replacing changing pattern in a string with a new pattern


icydash

Recommended Posts

Hey guys.  So I'm trying to write a script that replaces footnote citations in one format with footnote citations in another format.

 

For example, the text will read:  "Then he went down the street.[1] That is where the police found him [2].  They immediately arrested him at the house. [3]"

 

And I would like the script to find the [ #] strings and replace them with {#} ... so that the string reads:

"Then he went down the street.{1} That is where the police found him {2}.  They immediately arrested him at the house. {3}"

 

Note that there will be double, and even tripple, digit footnotes, so the script has to be able to recognize [##] or [###] and replace the brackets with {} accordingly.

 

I'm not really sure how to do this, since the "pattern" is constantly changing depending on the number between the brackets.  Ideas?

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.