# Regular expression error

**URL:** <https://community.open-emr.org/t/regular-expression-error/2361>\
**Category:** Management and Administration\
**Created:** [May 12, 2005, 5:35am UTC](https://community.open-emr.org/t/regular-expression-error/2361 "2005-05-12T05:35:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 12, 2005, 5:35am UTC](https://community.open-emr.org/t/regular-expression-error/2361/1 "2005-05-12T05:35:40Z")

</div>

**[ericnormand](https://sourceforge.net/u/ericnormand/)** wrote on [Thursday, May 12, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93):

I’m getting errors that look like they have to do with the \ character in regular expressions.&nbsp; The two I have encountered so far are openemr/interface/main/myadmin/libraries/common.lib.php line 1082  
and  
openemr/interface/main/myadmin/main.php line 246

Is there a setting I’m missing, because these don’t seem to be bugs that could be passed up.

Eric

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 12, 2005, 6:31am UTC](https://community.open-emr.org/t/regular-expression-error/2361/2 "2005-05-12T06:31:51Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Thursday, May 12, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/c0bf):

What version of PHP, and where did the PHP build come from?&nbsp; It does smell a bit like a PHP bug or build problem.

I think Perl-compatible regex’s are more popular.&nbsp; You could try converting to those if you understand what’s going on.

– Rod \<rod at sunsetsystems dot com\>

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 14, 2005, 3:14am UTC](https://community.open-emr.org/t/regular-expression-error/2361/3 "2005-05-14T03:14:34Z")

</div>

**[ericnormand](https://sourceforge.net/u/ericnormand/)** wrote on [Saturday, May 14, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/11ee):

It’s php version 4.3.10-2 built for debian.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 15, 2005, 11:01am UTC](https://community.open-emr.org/t/regular-expression-error/2361/4 "2005-05-15T11:01:56Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Sunday, May 15, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/b0ca):

Looking at [http://www.php.net/manual/en/ref.regex.php](http://www.php.net/manual/en/ref.regex.php), the second “warning” is curious.&nbsp; It’s as if there are different ways you can build regular expression support and they are not compatible with each other.

Just a thought.&nbsp; I guess what I’d do is play with the regex’s.

– Rod \<rod at sunsetsystems dot com\>

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 16, 2005, 6:11pm UTC](https://community.open-emr.org/t/regular-expression-error/2361/5 "2005-05-16T18:11:48Z")

</div>

**[ericnormand](https://sourceforge.net/u/ericnormand/)** wrote on [Monday, May 16, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/3665):

I played with the one that gave me the error message and it seemed to work, but another one had a problem.&nbsp; That’s why the problem seemed more general.&nbsp; I wouldn’t mind playing with the regex’s, I just don’t know what they are supposed to be matching specifically – I’m afraid of guessing what the regex is trying to do.&nbsp; Basically with the first one I just made the slash into a triple slash, so it went from  
“^|[^\]” to “^|[^\\\]”.&nbsp; But this doesn’t really seem to make much sense as a matcher.&nbsp; Why put the ^ outside the brackets?

I’m also afraid to mess with php regex settings because I have other programs running that are working.

Thanks  
Eric

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 16, 2005, 6:16pm UTC](https://community.open-emr.org/t/regular-expression-error/2361/6 "2005-05-16T18:16:56Z")

</div>

**[ericnormand](https://sourceforge.net/u/ericnormand/)** wrote on [Monday, May 16, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/e4c4):

I reread it and thought I wasn’t clear.  
Basically, I interpreted the original regular expression to mean “the beginning of a string or anything but a back slash”&nbsp; so I made it three backslashes so that it wouldn’t escape out the bracket when php read the string and when the regex engine got a hold of it.&nbsp; But I can’t figure out if that is specifically what the programmer had in mind.

Eric

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [May 16, 2005, 10:15pm UTC](https://community.open-emr.org/t/regular-expression-error/2361/7 "2005-05-16T22:15:28Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Monday, May 16, 2005](https://sourceforge.net/p/openemr/discussion/202505/thread/f8376705/#9f93/b655):

The regex strings that you referred to are single-quoted in the PHP code.&nbsp; This means that PHP should not be escaping out the bracket.&nbsp; In theory, ‘\]’ and ‘\\]’ should be identical (the backslash will escape either a single quote or another backslash but nothing else).&nbsp; ‘\\\]’ will, I guess, be interpreted by PHP as ‘\\]’, as will ‘\\\\]’.

So again, I think this is some sort of PHP bug and unfortunately it will take some effort to solve your problem with reasonable confidence.

– Rod \<rod at sunsetsystems dot com\>
