T
Tony
Hi, I've had this problem for about a week now, I am trying to replace
the occurrences of given words in a documents for example if I was
given the text:
"7.00pm-8.00pm. Jack uncovers a secret government prison and Sherry
scolds Palmer for destroying everything they've worked for by going
public. At the police station, Sam is unimpressed when Kim tries to
convince him that she's really the victim of a kidnapping. Drama,
starring Kiefer Sutherland and Leslie Hope."
I have a list of words including "they've", "over", "or" etc...
I want to replace all occurrences of this using a regular expression,
using:
(they've)|(over)|(or) etc it will replace all occurrences, even those
in the middle of a word like 'worked' would become 'wked'.
However using ([\\W]((they've)|(over)|(or))[\\W])+ to only pick ones
with whitespace on either side, on their own; it will miss out the
ones at the start of the document because they don't have a space
infront, or the following one if you had say "or they've", "they've"
would still be there!
If anyone has any advice or solutions I'd be very thankful.
Tony Pierson
the occurrences of given words in a documents for example if I was
given the text:
"7.00pm-8.00pm. Jack uncovers a secret government prison and Sherry
scolds Palmer for destroying everything they've worked for by going
public. At the police station, Sam is unimpressed when Kim tries to
convince him that she's really the victim of a kidnapping. Drama,
starring Kiefer Sutherland and Leslie Hope."
I have a list of words including "they've", "over", "or" etc...
I want to replace all occurrences of this using a regular expression,
using:
(they've)|(over)|(or) etc it will replace all occurrences, even those
in the middle of a word like 'worked' would become 'wked'.
However using ([\\W]((they've)|(over)|(or))[\\W])+ to only pick ones
with whitespace on either side, on their own; it will miss out the
ones at the start of the document because they don't have a space
infront, or the following one if you had say "or they've", "they've"
would still be there!
If anyone has any advice or solutions I'd be very thankful.
Tony Pierson