Hi everyone,
I'm working on a Google News RSS reader skin. Every item is of the form "[Headline] - [Source]". I'd like to remove the " - [Source]" from the displayed text. Is there any way to do this using Substitute? Right now, I'm using a crude workaround (Substitute=" - CNN":""," - BBC News":"", etc...). If it's not possible with Substitute, is there another way? Using RegExp perhaps?
Thanks!
It is currently April 26th, 2024, 7:58 pm
Using "Substitute" to remove a string with wildcards?
-
- Posts: 5
- Joined: January 30th, 2010, 3:10 pm
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Using "Substitute" to remove a string with wildcards?
No way with Substitute short of the brute force approach you mentioned. With RegExp, you COULD useShiva wrote:Hi everyone,
I'm working on a Google News RSS reader skin. Every item is of the form "[Headline] - [Source]". I'd like to remove the " - [Source]" from the displayed text. Is there any way to do this using Substitute? Right now, I'm using a crude workaround (Substitute=" - CNN":""," - BBC News":"", etc...). If it's not possible with Substitute, is there another way? Using RegExp perhaps?
Thanks!
<title>(.*) - .*
Which would return the title up to the first " - ", but you do run the risk of sometimes truncating the actual title information if it has that "space dash space" pattern in it.
-
- Posts: 5
- Joined: January 30th, 2010, 3:10 pm
Re: Using "Substitute" to remove a string with wildcards?
Thank you, worked like a charm!