Recursive balanced regex query needed...

I am trying to create a recursive balanced Regex query that will perform the following tasks:

[Test Code]

function test_func($test)


if ($this->test())


return $test;




return false;




echo " ";


The first PHP block should be caught by the regex and captured as a match; additionally, the second code block should be captured as well even with the echoed php code block.

Currently Im trying to accomplish this task with the following regex I found on google:

<\?(?>[^<\?>]+|<\?(?)|\?>(?<-number>) )*(?(number)(?!))\?>

This regex Im using will match the second code block perfectly but is failing to match and capture the first code block because I have "$this->test()" in the code and there is a "do not match on < or >" rule in the query. However it must match both example blocks perfectly, I just dont know how to change it to do so while still taking into account the tag balancing.

Im doing this with C# in .NET 2.0.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

Windows XP

Habilidades: Programação C#, Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software

Veja mais: using regex in c, regex is, regex in c, regex explained, regex example, regex c, recursive program example, recursive function example, n query, gnu regex c, gnu regex, a recursive function, regex &, php regex test, Regex, recursive, php regex, party block, c++ regex, c regex, google query, regex tag, regex php, platform regex, recursive php

Acerca do Empregador:
( 21 comentários ) Hillsboro, United States

ID do Projeto: #2972028

2 freelancers are bidding on average $102 for this job


See private message.

$34 USD em 1 dia
(6 Comentários)

See private message.

$170 USD em 1 dia
(5 Comentários)