473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Regular expression --> multiple line?

Hi,

If the users enters some data it must be have 1 ... 100 characters. These
characters may be placed on multiple lines. (textbox)

I use this: .{1,100}
But this only works with one line.

What do I have to change in this: .{1,100}

Thanks!
Nov 18 '05 #1
3 1364
This is actually much more complicated than it should be, the short answer
is to use (the very ineficient):

(.|\s){0,100}

the long answer is to read:
http://weblogs.asp.net/cosgood/archi...5/06/6604.aspx

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl**********@news3.zwoll1.ov.home.nl...
Hi,

If the users enters some data it must be have 1 ... 100 characters. These
characters may be placed on multiple lines. (textbox)

I use this: .{1,100}
But this only works with one line.

What do I have to change in this: .{1,100}

Thanks!

Nov 18 '05 #2
"Arjen" <bo*****@hotmail.com> wrote in
news:cl**********@news3.zwoll1.ov.home.nl:
Hi,

If the users enters some data it must be have 1 ... 100
characters. These characters may be placed on multiple lines.
(textbox)

I use this: .{1,100}
But this only works with one line.

What do I have to change in this: .{1,100}


Arjen,

Use the single line option in the regex:

(?s).{1,100}

This will treat multiple lines as one single line.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #3
Thanks!

Arjen


"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> schreef in bericht
news:Xn**********************************@207.46.2 48.16...
"Arjen" <bo*****@hotmail.com> wrote in
news:cl**********@news3.zwoll1.ov.home.nl:
Hi,

If the users enters some data it must be have 1 ... 100
characters. These characters may be placed on multiple lines.
(textbox)

I use this: .{1,100}
But this only works with one line.

What do I have to change in this: .{1,100}


Arjen,

Use the single line option in the regex:

(?s).{1,100}

This will treat multiple lines as one single line.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
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...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
2
by: Ramesh | last post by:
I have a reguar expression syntax that works fine when used in a RegularExpressionValidation control. If I use the exact same regular expression using System.Text.RegularExpressions.Regex to...
3
by: Zach | last post by:
Hello, Please forgive if this is not the most appropriate newsgroup for this question. Unfortunately I didn't find a newsgroup specific to regular expressions. I have the following regular...
25
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...
2
by: mehdi | last post by:
Hi, Consider the following string: <div>whatever text goes here, and maybe it contains a carriage return and/or line feed and it spans in multiple lines</div> How am I supposed to write an...
10
by: Wayne | last post by:
I wish to remove the last newline (if any) from a string. This is where I started: var text = "hello\n"; text = text.replace( /^(.*)\n?$/, "$1" ); This seems to work, but not if the test has...
9
by: micron_make | last post by:
I am trying to parse a file whose contents are : parameter=current max=5A min=2A for a single line I used for line in file: print re.search("parameter\s*=\s*(.*)",line).groups()
3
by: manishabh77 | last post by:
I want to extract some info from the following input line using perl regular expression. I will appreciate any help in doing so. input line: hg19_ensGene_ENST00000237247...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.