473,385 Members | 1,944 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,385 software developers and data experts.

Purpose of '#' character in regular expressions

3
Hi,

Quick question here, and wondering if anyone can help. I often see the hash character ('#') in regular expressions and am wondering what purpose it is supposed to serve.

Example:

[PHP]#(?<=[\x00-\x40\x5b-\x60\x7b-\x7f]|^)[/PHP]
Every bit of online documentation I have looked at states the hash character's purpose is merely to denote the line is a comment. Clearly this is not the case if the regular expression is actually being used to test for something.

Can anyone help?
Oct 7 '07 #1
5 20829
vapour
3
Just bumping here...hope that's OK. Again, any response will be very much appreciated.
Oct 10 '07 #2
code green
1,726 Expert 1GB
I don't think it has any syntax value, but then again I am terrifiied of regular expressions.
Are you looking at examples where the hash is part of the pattern to be found by any chance.
Oct 10 '07 #3
vapour
3
Thanks for the response. Nope, the hash just seems to be part of the furniture, so to speak. Some end in #si, for example, denoting it's a regex construction thing.

Any more ideas from anyone?
Oct 14 '07 #4
The hash character (i.e. '#') at the beginning and end is the indicator for the beginning and end of the regex pattern.
http://php.tutorialref.com/preg_replace-example.html
Oct 18 '10 #5
Patterns used in PHP PCRE (Perl Compatible Regular Expressions) must be surrounded by a delimiter, which can be non-alphanumeric, non-backslash, non-whitespace character. When you see the hash character at the start of the regex, it is because that particular developer chose it as the delimiter. You should see a hash at the end of the regex as well.

Source: http://php.net/manual/en/regexp.refe...delimiters.php
May 8 '18 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: yawnmoth | last post by:
say i wanted to match a string to a regular expression, but i was only given the string one character at a time. one way to do this would be to evaluate the most recently submitted character...
3
by: Fuzzyman | last post by:
I want to parse some text and generate an output that is similar but not identical to the input. The string I produce will be of similar length to the input string - but a bit longer. I'm...
1
by: Venkat | last post by:
Hi, I am using match function of string to find if a character is there in a string. The function Match is working fine with all the other characters except when the searching character is "+"....
6
by: Chris Anderson | last post by:
Anyone know of a fix (ideally) or an easy workaround to the problem of escape characters not working in regex replacement text? They just come out as literal text For example, you'd think that thi...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
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...
4
by: anil | last post by:
Hi everybody, I have some n number of Names, the string i am declaring should take any names, for Ex: As for searching any file we use "*.*" is there any thing simillar to this that i can use...
10
by: kevinliu23 | last post by:
Hey guys, I want to be able to insert a '-' character in front of all numeric values in a string. I want to insert the '-' character to use in conjunction with the getopt.getopt() function. ...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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...
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.