PHP Classes

File: tests/lookbehind.php

Recommend this page to a friend!
  Classes of Patrick Van Bergen   PHP Regex Builder   tests/lookbehind.php   Download  
File: tests/lookbehind.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Regex Builder
Generate regular expression strings from rules
Author: By
Last change:
Date: 7 years ago
Size: 597 bytes
 

Contents

Class file image Download
<?php

// lookAhead positive
test('/(?=monkey)/',
   
R::expression()->lookAhead(R::lookAhead()->text('monkey'))
);

// lookBehind negative
test('/(?!monkey)/',
   
R::expression()->lookAhead(R::lookAhead()->negative()->text('monkey'))
);

// lookBehind positive
test('/(?<=monkey)/',
   
R::expression()->lookBehind(R::lookBehind()->text('monkey'))
);

// lookBehind negative
test('/(?<!monkey)/',
   
R::expression()->lookBehind(R::lookBehind()->negative()->text('monkey'))
);

// look ahead in groups
test('/((?=monkey))/',
   
R::expression()->group(R::group()->lookAhead(R::lookAhead()->text('monkey')))
);