Hi
I need to split a comma delimited text, however if the comma is between ' '
then no split should occur
ie:
Class.Value, 'true' , 'some text', 'false', 'text, text, text'
should split into:
Class.Value
'true'
'some text
'false', 'text, text, text'
what split expression should I use for that??
TIA
Søren 5 2597
SMOlesen wrote: Hi
I need to split a comma delimited text, however if the comma is between ' ' then no split should occur
ie:
Class.Value, 'true' , 'some text', 'false', 'text, text, text'
should split into:
Class.Value 'true' 'some text
Why should the apostrophe be removed? Or is it a typo?
'false', 'text, text, text'
Why shouldn't it split between 'false' and 'text, text, text'?
what split expression should I use for that??
Sorry, it was a typo, it should split into:
Class.Value
'true'
'some text'
'false'
'text, text, text'
ie. it shouldn't split on comma if the comma is between two apostrophes....
..NET regular expression.....
"Göran Andersson" <gu***@guffa.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SMOlesen wrote: Hi
I need to split a comma delimited text, however if the comma is between ' ' then no split should occur
ie:
Class.Value, 'true' , 'some text', 'false', 'text, text, text'
should split into:
Class.Value 'true' 'some text
Why should the apostrophe be removed? Or is it a typo?
'false', 'text, text, text'
Why shouldn't it split between 'false' and 'text, text, text'?
what split expression should I use for that??
Make a pattern that matches one item, something like
"(?:([^,]+|'[^']*')", and use the Matches method to get a collection of
Match items that each contains one item.
SMOlesen wrote: Sorry, it was a typo, it should split into:
Class.Value 'true' 'some text' 'false' 'text, text, text'
ie. it shouldn't split on comma if the comma is between two apostrophes....
.NET regular expression.....
"Göran Andersson" <gu***@guffa.co m> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SMOlesen wrote: Hi
I need to split a comma delimited text, however if the comma is between ' ' then no split should occur
ie:
Class.Value, 'true' , 'some text', 'false', 'text, text, text'
should split into:
Class.Value 'true' 'some text Why should the apostrophe be removed? Or is it a typo?
'false', 'text, text, text' Why shouldn't it split between 'false' and 'text, text, text'?
what split expression should I use for that??
Hi Göran
Doesn't seem to solve the problem, if I look at the matches I get:
Class.Value
'true'
'some text'
'false'
'text
text
text'
wouldn't I have to use som king of negative lookbehind??
Regards,
Søren
"Göran Andersson" <gu***@guffa.co m> wrote in message
news:eL******** ********@TK2MSF TNGP03.phx.gbl. .. Make a pattern that matches one item, something like "(?:([^,]+|'[^']*')", and use the Matches method to get a collection of Match items that each contains one item.
SMOlesen wrote: Sorry, it was a typo, it should split into:
Class.Value 'true' 'some text' 'false' 'text, text, text'
ie. it shouldn't split on comma if the comma is between two apostrophes....
.NET regular expression.....
"Göran Andersson" <gu***@guffa.co m> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SMOlesen wrote: Hi
I need to split a comma delimited text, however if the comma is between ' ' then no split should occur
ie:
Class.Value, 'true' , 'some text', 'false', 'text, text, text'
should split into:
Class.Value 'true' 'some text Why should the apostrophe be removed? Or is it a typo?
'false', 'text, text, text' Why shouldn't it split between 'false' and 'text, text, text'?
what split expression should I use for that??
When I look at the pattern I gave you, I see that the parantheses
doesn't match, so it won't be usable. How did the pattern look that you
used?
I think that just disallowing apostrophes in the first set will fix it:
"([^',]+|'[^']*')"
Søren M. Olesen wrote: Hi Göran
Doesn't seem to solve the problem, if I look at the matches I get:
Class.Value 'true' 'some text' 'false' 'text text text'
wouldn't I have to use som king of negative lookbehind??
Regards,
Søren "Göran Andersson" <gu***@guffa.co m> wrote in message news:eL******** ********@TK2MSF TNGP03.phx.gbl. .. Make a pattern that matches one item, something like "(?:([^,]+|'[^']*')", and use the Matches method to get a collection of Match items that each contains one item.
SMOlesen wrote: Sorry, it was a typo, it should split into:
Class.Value 'true' 'some text' 'false' 'text, text, text'
ie. it shouldn't split on comma if the comma is between two apostrophes....
.NET regular expression.....
"Göran Andersson" <gu***@guffa.co m> wrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. .. SMOlesen wrote: > Hi > > I need to split a comma delimited text, however if the comma is between > ' ' then no split should occur > > ie: > > Class.Value, 'true' , 'some text', 'false', 'text, text, text' > > should split into: > > Class.Value > 'true' > 'some text Why should the apostrophe be removed? Or is it a typo?
> 'false', 'text, text, text' Why shouldn't it split between 'false' and 'text, text, text'?
> what split expression should I use for that?? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arne |
last post by:
From: "Arne de Booij" <a_de_booij@hotmail.com>
Subject: Comma delimited array into DB problems
Date: 9. februar 2004 10:39
Hi,
I have an asp page that takes input from a form on the previous page,
puts that into an array and inserts the array into SQL server.
Now here is the problem:
|
by: Christine Forber |
last post by:
I wonder if anyone knows of some javascript code to check a
comma-delimited list of email addresses for basic formating.
What I'm looking for is the javascript code to check a form field on
form submission. If there is an entry in the field, does it match the
following:
text@text.text, text@text.text,text@text.text
where each address...
|
by: William Stacey [MVP] |
last post by:
Would like help with a (I think) a common regex split example. Thanks for
your example in advance. Cheers!
Source Data Example:
one "two three" four
Optional, but would also like to ignore pairs of brackets like:
"one" <tab> "two three" ( four "five six" )
Want fields like:
|
by: Joe Fisherman |
last post by:
I have used regex to parse a huge text file, and grab a tab delimited
portion of it. I often use comma delimited text files, and use Jet Oledb4.
I read that I would need an ini if the file wasn't comma delimited - if
this is true, I am not sure of the easiest process to create an ini. The
string has a header.
My string looks like:
...
|
by: Bernie Yaeger |
last post by:
Is there a way to convert or copy a .xml file to a comma delimited text file
using vb .net?
Thanks for any help.
Bernie Yaeger
| |
by: JustSomeGuy |
last post by:
Hi. I have a comma delimited text file that I want to parse.
I was going to use fscanf from the C library but as my app is written
in C++
I thought I'd use the std io stream library...
My Text file looks like:
First_Name, Last_Name, ID, Date/Of/Birth<newline>
depending on the host the newline is either \n or \r\n
|
by: Ron |
last post by:
so if my textbox is named textbox1 and my listbox is named
ltsdisplay, for the button that would make this all happen I would
just need to:
lstdisplay.items.textbox1(delimited.Split(",".ToCharArray()))
is that right? or no? I try this and I get an error...
|
by: conspireagainst |
last post by:
I'm having quite a time with this particular problem:
I have users that enter tag words as form input, let's say for a photo or a topic of discussion. They are allowed to delimit tags with spaces and commas, and can use quotes to encapsulate multiple words.
An example:
tag1, tag2 tag3, "tag4 tag4, tag4" tag5, "tag6 tag6"
So, as we can...
|
by: =?Utf-8?B?bWFnZ2ll?= |
last post by:
hi,
I need some help with a reg. expression. I have a comma delimited file with
quotes. Not every field has quotes, only some. This is a sample of my file:
99,"01/01/2007","23,000",1,34,"henry",132,"45.00"
I used some code from an article that I though would do what I needed, but
it splits my amount fields(76,000 into two different fields...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |