473,406 Members | 2,769 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,406 software developers and data experts.

What about ^0, $ in Regular expression

ad
I found a Regular expression in
http://www.regexlib.com/DisplayPatte...tegoryId=7What
do the ^0, $ mean in the begin and end of Regular
expression?^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
Nov 17 '05 #1
5 1729
pretty sure that ^ is beginning of line and that $ is end.
"ad" wrote:
I found a Regular expression in
http://www.regexlib.com/DisplayPatte...tegoryId=7What
do the ^0, $ mean in the begin and end of Regular
expression?^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$

Nov 17 '05 #2
ad
What make difference if we omit ^ or $ at begin and end?

"Phil" <Ph**@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:20********************************* *@microsoft.com...
pretty sure that ^ is beginning of line and that $ is end.
"ad" wrote:
I found a Regular expression in
http://www.regexlib.com/DisplayPatte...tegoryId=7What
do the ^0, $ mean in the begin and end of Regular
expression?^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$

Nov 17 '05 #3
If I were searching for 'abc' and I did not have ^ and $ it would find it
would find it in the middle of strings, that is at any position in the string.

The ^ means it must start with the first character of the string to be
searched and the $ that it must be the ending character of the searched text.


"ad" wrote:
What make difference if we omit ^ or $ at begin and end?

"Phil" <Ph**@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:20*********************** ***********@microsoft.com...
pretty sure that ^ is beginning of line and that $ is end.
"ad" wrote:
I found a Regular expression in
http://www.regexlib.com/DisplayPatte...tegoryId=7What
do the ^0, $ mean in the begin and end of Regular
expression?^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$


Nov 17 '05 #4
Valid entries for: ^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
would be:
02-1000000
021000000
021999999
02-8888888

However each number must be the complete string. i.e. '02-8888888' not
'02-8888888 ' a space at the end or ' 02-8888888' a space at the begining.

The ^0 means it must start with a zero. The bracketed [2-9]{1} means that
you must have one character following it that is any character 2 through 7,
etc.
Nov 17 '05 #5
ad
Thanks

"Phil" <Ph**@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:45********************************* *@microsoft.com...
Valid entries for:
^0[234679]{1}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$
would be:
02-1000000
021000000
021999999
02-8888888

However each number must be the complete string. i.e. '02-8888888' not
'02-8888888 ' a space at the end or ' 02-8888888' a space at the begining.

The ^0 means it must start with a zero. The bracketed [2-9]{1} means that
you must have one character following it that is any character 2 through
7,
etc.

Nov 17 '05 #6

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

Similar topics

9
by: MJ | last post by:
HI I want to know what is mean by regular expression in C Mayur
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
10
by: Lee Kuhn | last post by:
I am trying the create a regular expression that will essentially match characters in the middle of a fixed-length string. The string may be any characters, but will always be the same length. In...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
3
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...
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...
6
by: rorymo | last post by:
I have a regular expression that allows only certain characters to be valid in an xml doc as follows: <xs:pattern value="^*" /> What I want to do is also allow any unicode character that is...
0
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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...
0
agi2029
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,...
0
isladogs
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 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.