Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of Python's "findAll" function in PHP?

Tags:

php

findall

re.findall(r'(\b[a-zA-Z][a-zA-Z0-9-]*)(?=\.com\b)', DATA)

how would this line be in PHP?

like image 516
Gal Avatar asked Nov 24 '25 08:11

Gal


2 Answers

I think you're looking for preg_match_all.

like image 174
Josh Leitzel Avatar answered Nov 26 '25 22:11

Josh Leitzel


preg_match_all('/(\b[a-zA-Z][a-zA-Z0-9-]*)(?=.com\b)/',$data,$matches);

like image 23
Felipe Ribeiro Avatar answered Nov 26 '25 20:11

Felipe Ribeiro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!