473,546 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Purpose of '#' character in regular expressions

3 New Member
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 20917
vapour
3 New Member
Just bumping here...hope that's OK. Again, any response will be very much appreciated.
Oct 10 '07 #2
code green
1,726 Recognized Expert Top Contributor
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 New Member
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
ahoffmann
1 New Member
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
1784
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 along with every previously submitted character, however, that way seems like it would be unnecessarily inefficient. another way i can see of doing...
3
2230
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 parsing character by character and adding the characters of the input string to the output until I come to ones I want to modify. This means creating a...
1
3968
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 "+". Here is the piece of code i am using var line1 = "Hell+O";
6
8828
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 Regex.Replace("<stuff>text</stuff>", "<stuff>", "<stuff>\n" would give yo <stuff text</stuff
2
5008
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 have to use all the expressions seperately? Here are my regular expressions that check for valid email address and link Dim Expression As String =
7
3801
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 want to avoid that. My question here is if there is a way to pass either a memory stream or array of "find", "replace" expressions or any other way...
4
1137
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 in VB code to specify any string. Thanks & Regards Anil.Hungund
10
2643
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. Rigt now, I'm implementing a menu system where users will be able to select a set of options like "2a 3ab" which corresponds to menu choices....
1
4363
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 the first regular expression that matches the string. I've gor the regular expressions ordered so that the highest priority is first (if two or more...
0
7435
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...
0
7694
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, 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. ...
0
7792
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5080
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...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
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
0
747
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.