I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the following
double quote
number
double quote
comma
double quote
alpha string
double quote
carriage return
The following comes close, but doesn't check for a carriage return at the
end of each line:
^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John"
"2","Paul"
"3","George "
"4","Ringo"
Any suggestions would be appreciated. 5 2263
Bosconian wrote:
I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the following
double quote
number
double quote
comma
double quote
alpha string
double quote
carriage return
The following comes close, but doesn't check for a carriage return at the
end of each line:
^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John"
"2","Paul"
"3","George "
"4","Ringo"
Any suggestions would be appreciated.
Try the /s modifier. Perhaps a bit "tipsy" to examine the regex in depth.
Curtis
On 13 Feb, 04:06, "Bosconian" <nob...@nowhere .comwrote:
I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the following
double quote
number
double quote
comma
double quote
alpha string
double quote
carriage return
The following comes close, but doesn't check for a carriage return at the
end of each line:
^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John"
"2","Paul"
"3","George "
"4","Ringo"
Any suggestions would be appreciated.
The ? following [0-9] means that
"","John" will also be matched.
Also, the * before the $ means that
"1" will be matched
So at the very least you want
^"[0-9]+"([,]\s?\"([A-Za-z0-9]+)")$
Since a $ means "the end of the line" and since a carriage return
signifies the end of a line, his should do. Or do you want to ensure
that there is a carriage return at theend, even if there is only one
line?
"Captain Paralytic" <pa**********@y ahoo.comwrote in message
news:11******** **************@ s48g2000cws.goo glegroups.com.. .
On 13 Feb, 04:06, "Bosconian" <nob...@nowhere .comwrote:
>I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the following
double quote number double quote comma double quote alpha string double quote carriage return
The following comes close, but doesn't check for a carriage return at the end of each line:
^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John" "2","Paul" "3","George " "4","Ringo"
Any suggestions would be appreciated.
The ? following [0-9] means that
"","John" will also be matched.
Also, the * before the $ means that
"1" will be matched
So at the very least you want
^"[0-9]+"([,]\s?\"([A-Za-z0-9]+)")$
Since a $ means "the end of the line" and since a carriage return
signifies the end of a line, his should do. Or do you want to ensure
that there is a carriage return at theend, even if there is only one
line?
Thank you for your response and for the pattern corrections.
A trailing carriage return on the last line would be unnecessary and ignored
if present. However, any preceding pairs must have a carriage return at the
end of each line. Where in the pattern is this mandated?
I don't have the opportunity to use regular expressions consistency, but I
am anxious to learn the syntax and am grateful for your instruction.
On 13 Feb, 13:36, "Bosconian" <nob...@nowhere .comwrote:
"Captain Paralytic" <paul_laut...@y ahoo.comwrote in message
news:11******** **************@ s48g2000cws.goo glegroups.com.. .
On 13 Feb, 04:06, "Bosconian" <nob...@nowhere .comwrote:
I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the
following
double quote
number
double quote
comma
double quote
alpha string
double quote
carriage return
The following comes close, but doesn't check for a carriage return at the
end of each line:
^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John"
"2","Paul"
"3","George "
"4","Ringo"
Any suggestions would be appreciated.
The ? following [0-9] means that
"","John" will also be matched.
Also, the * before the $ means that
"1" will be matched
So at the very least you want
^"[0-9]+"([,]\s?\"([A-Za-z0-9]+)")$
Since a $ means "the end of the line" and since a carriage return
signifies the end of a line, his should do. Or do you want to ensure
that there is a carriage return at theend, even if there is only one
line?
Thank you for your response and for the pattern corrections.
A trailing carriage return on the last line would be unnecessary and ignored
if present. However, any preceding pairs must have a carriage return at the
end of each line. Where in the pattern is this mandated?
I don't have the opportunity to use regular expressions consistency, but I
am anxious to learn the syntax and am grateful for your instruction.- Hide quoted text -
- Show quoted text -
If you are treating each line as a separate string, then the $ will
indicate this. If you are treating all the lines as a single string
then I need to ask, is it only a carriage return that you will have at
the end of each line and all you want to check for? Sometimes lines
can be ended by a carriage return and a new line (\r\n) \nd sometimes
by a new line only (\n). It is unusual for a line to have only a
carriage return on its own (\r) as, on older printers, this would lead
to the next line overtyping the previous one.
"Captain Paralytic" <pa**********@y ahoo.comwrote in message
news:11******** *************@q 2g2000cwa.googl egroups.com...
On 13 Feb, 13:36, "Bosconian" <nob...@nowhere .comwrote:
>"Captain Paralytic" <paul_laut...@y ahoo.comwrote in message
news:11******* *************** @s48g2000cws.go oglegroups.com. ..
On 13 Feb, 04:06, "Bosconian" <nob...@nowhere .comwrote: I have a textarea form field for inputting (or pasting) pairs of data.
>I need a regular expression pattern to validate each line for the following
>double quote number double quote comma double quote alpha string double quote carriage return
>The following comes close, but doesn't check for a carriage return at the end of each line:
>^"([0-9]?)+"([,]\s?\"([A-Za-z0-9]+)")*$
>For example the following would return true:
>"1","John" "2","Paul" "3","George " "4","Ringo"
>Any suggestions would be appreciated.
The ? following [0-9] means that
"","John" will also be matched.
Also, the * before the $ means that
"1" will be matched
So at the very least you want
^"[0-9]+"([,]\s?\"([A-Za-z0-9]+)")$
Since a $ means "the end of the line" and since a carriage return
signifies the end of a line, his should do. Or do you want to ensure
that there is a carriage return at theend, even if there is only one
line?
Thank you for your response and for the pattern corrections.
A trailing carriage return on the last line would be unnecessary and ignored if present. However, any preceding pairs must have a carriage return at the end of each line. Where in the pattern is this mandated?
I don't have the opportunity to use regular expressions consistency, but I am anxious to learn the syntax and am grateful for your instruction.- Hide quoted text -
- Show quoted text -
If you are treating each line as a separate string, then the $ will
indicate this. If you are treating all the lines as a single string
then I need to ask, is it only a carriage return that you will have at
the end of each line and all you want to check for? Sometimes lines
can be ended by a carriage return and a new line (\r\n) \nd sometimes
by a new line only (\n). It is unusual for a line to have only a
carriage return on its own (\r) as, on older printers, this would lead
to the next line overtyping the previous one.
Yes, I assume we're talking about \n or \r\n.
Incidentally, I would like to support several methods of entry. My idea is
to have the user select a radio button for the format. For example,
optionally the user could input
1,John
2,Paul
3,George
4,Ringo
1,John,2,Paul,3 ,George,4,Ringo
I eventually want it to work the same was as phpMyAdmin's import feature.
However, this will be used by non-tech savvy users so validation will play
an important part.
Again, thanks for your help. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: amazononthemoon |
last post by:
I have not been able to find any examples of the type of validation I need.
I have numeric fields on a web page that I only want them to enter numbers
with two decimal places. I would like to allow them to enter a number with
comma or with out comma. (for example the could enter 1000.00 or 1,000.00 or
1000)
The other field I need help with is a list of user ID separated by comma,
ie user123, userabc, user321. They could enter one user...
|
by: Sue |
last post by:
Hello
I'm new to this Regular Expression and need some help. I want to
restrict what the user types in a text box.
The User can type only A-Z, a-z, 0-9, spaces, comma, dash, period,
single and double quotes.
If it has anything other than that, I need to display message. How
would I do that? Any help is appreciated.
|
by: Jorell |
last post by:
Hi everyone. I have never worked with regular expressions
before and here is my dillema:
I have a textbox that I want to only accept this type of
input:
1,2,3-8,10,16 ( Comma separated numbers or Hyphenated
ranges )
I want to use a validator for this, so I assume I use a
|
by: |
last post by:
Hi,
I have a Regular Expression that will match the format a
user provides in a textbox.
Ex. Brown,Joe in the textbox
I would like the expression to have both whitespace and
non-whitespace options after the comma.
|
by: James D. Marshall |
last post by:
The issue at hand, I believe is my comprehension of using regular
expression, specially to assist in replacing the expression with other text.
using regular expression (\s*) my understanding is that this will one or
more occurrences to replace all the white space between with a comma.
This search
ElseIf InStr(1, indivline, "$") Then
insert a replace statement that uses the regular expression to find and
replace all the white space...
| |
by: LordHog |
last post by:
Hello all,
I am attempting to create a small scripting application to be used
during testing. I extract the commands from the script file I was going
to tokenize the each line as one of the requirements is there one
command per line. I have always wanted to learn Regular Expressions, so
I was hoping I might do this using Regular Expressions. For a fair
number of the command will have the syntax like
Write( 0x123, 0x12, 25, 100 ) <-...
|
by: samuelberthelot |
last post by:
Hi,
I'd like to use regular expression for checking validity of a field.
What would be the expression for :
firstname, lastname, organisation23
so basically, a string + comma then another string + comma then a
alphanumeric string
|
by: hellbent4u |
last post by:
Hi All,
I need a regular expression to be used in an ASP page which would
allow a user to enter:
1000 as well as
1,000
i.e. an amount without comma as well as with comma(for example 10,000
or 100,000 etc.)
|
by: shawnmkramer |
last post by:
Anyone every heard of the Regex.IsMatch and Regex.Match methods just
hanging and eventually getting a message "Requested Service not
found"?
I have the following pattern:
^(?<OrgCity>(+)+), City of, (?<OrgState>(()|(
+\.)))( \((?<OrgCountry>{2,})\))?$
(ignore the line wrap)
|
by: graphicsxp |
last post by:
Hi,
I can't figure out what the regular expression would look like for
validating a string such as :
Lastname, Firstname
I could only come up with /\w/ which doesn't check for the comma.
Can someone help ?
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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.
| |