Hi
I need to write one regex to read all the fields from the following lines /
file format
line 1 - some_alphanumeric,some_alphanumeric,"something,
something",numbers_hyphenatedORnot
line 2 - some_alphanumeric,some_alphanumeric,something
something,numbers_hyphenatedORnot
At first I thought this one will do
"[^"\r\n]*",|[A-Za-z0-9 ]*,|[0-9]*\-[0-9]*
but I am getting the delimiters such as the trailing comma and the
double-quote along with the fields !!
Can this be modified to get the fields only, or at least to get rid of the
trailing comma?
TIA
-- 3 1441
> line 1 - some_alphanumeric,
[A-Za-z0-9 ]*,
some_alphanumeric,
[A-Za-z0-9 ]*,
"something, something",
"[~"]*",
numbers_hyphenatedORnot
[0-9-]*
All together: [A-Za-z0-9 ]*,[A-Za-z0-9 ]*,"[~"]*",[0-9-]* line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[0-9-]*
Combine it all into one big one:
[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,("[^"]*")|([A-Za-z0-9 ]*),[0-9-]*
Any character in "A-Za-z0-9 "
* (zero or more times)
,
Any character in "A-Za-z0-9 "
* (zero or more times)
,
Capture
"
Any character not in """
* (zero or more times)
"
End Capture
or
Capture
Any character in "A-Za-z0-9 "
* (zero or more times)
End Capture
,
Any character in "0-9-"
* (zero or more times)
(Interpretation via Regular Expression Workbench)
--
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
<dl> wrote in message news:eT**************@TK2MSFTNGP15.phx.gbl... Hi
I need to write one regex to read all the fields from the following lines
/ file format line 1 - some_alphanumeric,some_alphanumeric,"something, something",numbers_hyphenatedORnot line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
At first I thought this one will do "[^"\r\n]*",|[A-Za-z0-9 ]*,|[0-9]*\-[0-9]*
but I am getting the delimiters such as the trailing comma and the double-quote along with the fields !!
Can this be modified to get the fields only, or at least to get rid of the trailing comma?
TIA
--
Hi Curran
Thanks.
With some minor changes, I get a much cleaner one (compare to the one I
originally had)
[A-Za-z0-9 -]*,|("[^"]*"),|[0-9 ()-]*
but I have one question
1. there is still trialing comma, I guess we can't get rid of it, and just
have to trim it off, right?
TIA
"James Curran" <ja*********@mvps.org> wrote in message
news:ey****************@TK2MSFTNGP14.phx.gbl... line 1 - some_alphanumeric, [A-Za-z0-9 ]*,
some_alphanumeric, [A-Za-z0-9 ]*,
"something, something", "[~"]*",
numbers_hyphenatedORnot [0-9-]*
All together: [A-Za-z0-9 ]*,[A-Za-z0-9 ]*,"[~"]*",[0-9-]*
line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[0-9-]*
Combine it all into one big one: [A-Za-z0-9 ]*,[A-Za-z0-9 ]*,("[^"]*")|([A-Za-z0-9 ]*),[0-9-]*
Any character in "A-Za-z0-9 " * (zero or more times) , Any character in "A-Za-z0-9 " * (zero or more times) , Capture " Any character not in """ * (zero or more times) " End Capture or Capture Any character in "A-Za-z0-9 " * (zero or more times) End Capture , Any character in "0-9-" * (zero or more times)
(Interpretation via Regular Expression Workbench)
-- -- Truth, James Curran [erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com
<dl> wrote in message news:eT**************@TK2MSFTNGP15.phx.gbl... Hi
I need to write one regex to read all the fields from the following
lines / file format line 1 - some_alphanumeric,some_alphanumeric,"something, something",numbers_hyphenatedORnot line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
At first I thought this one will do "[^"\r\n]*",|[A-Za-z0-9 ]*,|[0-9]*\-[0-9]*
but I am getting the delimiters such as the trailing comma and the double-quote along with the fields !!
Can this be modified to get the fields only, or at least to get rid of
the trailing comma?
TIA
--
instead of the last * use a + which means "count bigger than one" so that
the comma should disappear.
<dl> schrieb im Newsbeitrag news:uL**************@TK2MSFTNGP15.phx.gbl... Hi Curran
Thanks. With some minor changes, I get a much cleaner one (compare to the one I originally had) [A-Za-z0-9 -]*,|("[^"]*"),|[0-9 ()-]* but I have one question 1. there is still trialing comma, I guess we can't get rid of it, and just have to trim it off, right?
TIA
"James Curran" <ja*********@mvps.org> wrote in message news:ey****************@TK2MSFTNGP14.phx.gbl... line 1 - some_alphanumeric,
[A-Za-z0-9 ]*,
some_alphanumeric, [A-Za-z0-9 ]*,
"something, something", "[~"]*",
numbers_hyphenatedORnot [0-9-]*
All together: [A-Za-z0-9 ]*,[A-Za-z0-9 ]*,"[~"]*",[0-9-]*
line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[A-Za-z0-9 ]*,[0-9-]*
Combine it all into one big one: [A-Za-z0-9 ]*,[A-Za-z0-9 ]*,("[^"]*")|([A-Za-z0-9 ]*),[0-9-]*
Any character in "A-Za-z0-9 " * (zero or more times) , Any character in "A-Za-z0-9 " * (zero or more times) , Capture " Any character not in """ * (zero or more times) " End Capture or Capture Any character in "A-Za-z0-9 " * (zero or more times) End Capture , Any character in "0-9-" * (zero or more times)
(Interpretation via Regular Expression Workbench)
-- -- Truth, James Curran [erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com Blog: www.honestillusion.com Day Job: www.partsearch.com
<dl> wrote in message news:eT**************@TK2MSFTNGP15.phx.gbl... Hi
I need to write one regex to read all the fields from the following lines / file format line 1 - some_alphanumeric,some_alphanumeric,"something, something",numbers_hyphenatedORnot line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot
At first I thought this one will do "[^"\r\n]*",|[A-Za-z0-9 ]*,|[0-9]*\-[0-9]*
but I am getting the delimiters such as the trailing comma and the double-quote along with the fields !!
Can this be modified to get the fields only, or at least to get rid of the trailing comma?
TIA
--
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kenneth McDonald |
last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate
feedback, suggestions, and criticism as I work towards finalizing the
API and feature sets. rex is a module intended to make...
|
by: hillcountry74 |
last post by:
Hi,
I'm stuck with this regular expression from past 2 days. Desperately
need help.
I need a regular expression that will allow all characters except these
*:~<>'
This is my code in...
|
by: Buddy |
last post by:
Can someone please show me how to create a regular expression to do the
following
My text is set to
MyColumn{1, 100} Test
I want a regular expression that sets the text to the following...
|
by: VSK |
last post by:
Hi all,
I have a .ascx file with
dropdownbox (SSN, EmpName)
textbox
submit button
regular expression validator( controltovalidate is the above textbox)
Now i want to change the Regular...
|
by: Lisa Bogart |
last post by:
I am trying to take a string and parse it out into multiple strings
based on a pattern but am stuck and am hoping someone can give me a
clue.
My pattern looks like so: sMatch =...
| |
by: Billa |
last post by:
Hi,
I am replaceing a big string using different regular expressions (see
some example at the end of the message). The problem is whenever I
apply a "replace" it makes a new copy of string and I...
|
by: kieran |
last post by:
Hi,
I am using Visual Studio 2005 and am trying to use a Regular Expression
Validator control.
I have a drop down list which contains various names, the first one is
"Please Select". I want...
|
by: Mike |
last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in
matches. I would like to get what the actual regular expression is.
In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
|
by: sk.rasheedfarhan |
last post by:
Hi ,
I am using regular expression in C++ code, . Negation is not working in the down loaded
code. matches all characters except "a", "b",
and "c]
So I am in dilemma can negation work in C++...
|
by: sunil |
last post by:
Hi,
Am writing one C program for one of my module and facing one problem
with the regular expression functions provided by the library libgen.h
in solaris.
In this library we are having two...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
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...
|
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,...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| | |