Skip to main content
added 119 characters in body
Source Link
johnlemon
  • 21.6k
  • 45
  • 124
  • 181

Can I extract the string aaa without using subpatterns (but still using regexp)?

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

Update

  • lookahead and lookbehind is a second solution, any other ?

I'm just trying to figure out some regexp alternatives !

Can I extract the string aaa without using subpatterns (but still using regexp)?

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

Can I extract the string aaa without using subpatterns (but still using regexp)?

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

Update

  • lookahead and lookbehind is a second solution, any other ?

I'm just trying to figure out some regexp alternatives !

Can I extract the string aaaaaa without using subpatterns ( butbut still using regexp  ):?

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

?

Can I extract the string aaa without using subpatterns ( but still using regexp  ):

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

?

Can I extract the string aaa without using subpatterns (but still using regexp)?

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);
Source Link
johnlemon
  • 21.6k
  • 45
  • 124
  • 181

How to extract a string with a regexp?

Can I extract the string aaa without using subpatterns ( but still using regexp ):

$str = 'abc#aaa#abc';
preg_match('/#(.*)#/', $str, $matches);
print_r($matches);

?