example: "(?<namedrange>and here goes regex)
but how to refer to it, i know that with numbers it is \1\2\3 etc, or $1$2$3 - but I want something like this $<namedrange> - i tried many combinations and any do not work
Have a look here
Named Capture with Python, PCRE and PHP Python's regex module was the first to offer a solution: named capture. By assigning a name to a capturing group, you can easily reference it by name. B [/B]captures the match of group into the backreference "name". You can reference the contents of the group with the numbered backreference \1 or the named backreference (?P=name). The open source PCRE library has followed Python's example, and offers named capture using the same syntax. The PHP preg functions offer the same functionality, since they are based on PCRE.
Named Capture with Python, PCRE and PHP
Python's regex module was the first to offer a solution: named capture. By assigning a name to a capturing group, you can easily reference it by name. B [/B]captures the match of group into the backreference "name". You can reference the contents of the group with the numbered backreference \1 or the named backreference (?P=name).
The open source PCRE library has followed Python's example, and offers named capture using the same syntax. The PHP preg functions offer the same functionality, since they are based on PCRE.
http://www.regular-expressions.info/named.html
Maybe this is what you are after?
http://www.regular-expressions.info/named.html - I've read this page and tried many combinations that supposedly should be working but no one from this page does
What exactly did you try, and how does it not work?
I tried to refer to a named part of regexp. I know how to set name -> (?<name>[r][e]g[e][x].), but I do not know how to refer to it using that name and not by number.
Pythonesque:code[/code] Other notations (Perlish/Rubylike) are also recognised. See http://www.php.net/manual/en/regexp.reference.back-references.php; last paragraph.