2009-07-06, 01:56 PM
Okay, here is my string I'm working with.
"Todd taught me to move towards upper right-hand side to attack and kill #bJr. Sentinel#k"
I want it to turn into this:
"Todd taught me to move towards upper right-hand side to attack and kill [noparse]Jr. Sentinel[/noparse]"
Here's how I'm currently doing it:
Regular expression --> #b[\w ]*#k
Then snip off the ends (#b and #k)
Then add my tags ([noparse] and [/noparse])
Then do a string replace("[noparse]Jr. Sentinel[/noparse]" for "#bJr. Sentinel#k")
There's got to be a faster, more efficient way of doing this in Python. Any ideas?
"Todd taught me to move towards upper right-hand side to attack and kill #bJr. Sentinel#k"
I want it to turn into this:
"Todd taught me to move towards upper right-hand side to attack and kill [noparse]Jr. Sentinel[/noparse]"
Here's how I'm currently doing it:
Regular expression --> #b[\w ]*#k
Then snip off the ends (#b and #k)
Then add my tags ([noparse] and [/noparse])
Then do a string replace("[noparse]Jr. Sentinel[/noparse]" for "#bJr. Sentinel#k")
There's got to be a faster, more efficient way of doing this in Python. Any ideas?

