need some help with a str.replace expression to strip all content between any occurrence of parentheses and also remove parentheses
....
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ? 5 909
On May 8, 2:06*pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
need some help with a str.replace expression to strip all content between any occurrence of parentheses and also remove parentheses
...
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ?
Looks like it should, although you won't be stripping digits. What's
the issue?
"apatheticagnostic" <ap***************@gmail.comwrote in message
news:3f**********************************@m36g2000 hse.googlegroups.com...
On May 8, 2:06 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
need some help with a str.replace expression to strip all content between any occurrence of parentheses and also remove
parentheses
...
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ?
Looks like it should, although you won't be stripping digits. What's
the issue?
It's not working...
sample string is :
"Electronic media (DVDs, CDs), Paper (books, photos), Textiles (clothes, linens), Furniture"
should return:
"Electronic media, Paper, Textiles, Furniture"
On May 8, 3:23*pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
"apatheticagnostic" <apatheticagnos...@gmail.comwrote in message
news:3f**********************************@m36g2000 hse.googlegroups.com...
On May 8, 2:06 pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot
comwrote:
need some help with a str.replace expression to strip all content between any occurrence of parentheses and also remove
parentheses
...
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ?
Looks like it should, although you won't be stripping digits. What's
the issue?
It's not working...
sample string is :
"Electronic media (DVDs, CDs), Paper (books, photos), Textiles (clothes, linens), Furniture"
should return:
"Electronic media, Paper, Textiles, Furniture"
It's the commas in the parens.
str.replace(/\([^\)]*\)/gi, '');
In article <ZIWdnV4pe96T3L7VnZ2dnUVZ_jydnZ2d@palinacquisition >,
"Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot comwrote:
need some help with a str.replace expression to strip all content between any
occurrence of parentheses and also remove parentheses
...
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ?
\([^)]*\)
--
My personal UDP list: 127.0.0.1, 4ax.com, buzzardnews.com, googlegroups.com,
heapnode.com, localhost, ntli.net, teranews.com, vif.com, x-privat.org
In comp.lang.javascript message <3fc20dfe-e95f-4272-b5f1-4108644186b5@m3
6g2000hse.googlegroups.com>, Thu, 8 May 2008 11:40:40, apatheticagnostic
<ap***************@gmail.composted:
>On May 8, 2:06*pm, "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot comwrote:
>need some help with a str.replace expression to strip all content between any occurrence of parentheses and also remove parentheses ...
str.replace(/\([\w\s]*\)/gi, "");
any suggestions ?
Looks like it should, although you won't be stripping digits. What's the issue?
Posting correct untested answers requires real intelligence; one rarely
finds that in the witterings of anonymous gmail users.
The test string subsequently provided contains parenthesised commas; the
RegExp does not accommodate that.
This works on the test data : str.replace(/\([^)]*\)/g, "");
- Electronic media , Paper , Textiles , Furniture
And str.replace(/\s*\([^)]*\)/g, "");
- Electronic media, Paper, Textiles, Furniture
--
(c) John Stockton, nr London UK. ??*@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan |
last post by:
Hello,
I'd like to be able to take a formatted string and determine the
replacement dictionary necessary to do string interpolation with it.
For example:
>>> str = 'his name was %(name)s and...
|
by: Kerberos |
last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header
tag by a logo. The h1 is clickable if no CSS is applied but it I replace
it by the logo, the area isn't clickable anymore...
|
by: Vibha Tripathi |
last post by:
Hi Folks,
I put a Regular Expression question on this list a
couple days ago. I would like to rephrase my question
as below:
In the Python re.sub(regex, replacement, subject)...
|
by: andrewflanders |
last post by:
I have an associative array of keys and values. I want to search a
string for the existance of keys and replace them with the values in
the array. The problem is that some of the keys resemble...
|
by: Mike Meyer |
last post by:
I know, lambda bashing (and defending) in the group is one of the most
popular ways to avoid writing code. However, while staring at some Oz
code, I noticed a feature that would seem to make both...
|
by: talin at acm dot org |
last post by:
I've been reading about how "lambda" is going away in Python 3000 (or
at least, that's the stated intent), and while I agree for the most
part with the reasoning, at the same time I'd be sad to see...
|
by: brian |
last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript /
JavaScript and also in my favorite text editor: TextPad (www.textpad.com)
I don't know about JScript/JavaScript, but...
|
by: chris.fairles |
last post by:
Just want an opinion. I have an algorithm that needs to run as fast as
possible, in fact. Its already too slow. I've done as much algorithmic
changes as I can to reduce the amount of code, so now...
|
by: Phil Sandler |
last post by:
Hello,
What is the fastest/most efficient way of doing string replacement in
csharp/.net?
An example would be:
"Hello, my name is {FirstName}, and I live in the town of {City} with
my wife...
|
by: padmaneha |
last post by:
How to omit replacement in somepart of text using regular expression?
For ex:
If i want to replace mumbai with mumbai/aaa.com but if i have an anchor tag
<a...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |