I'm doing a search to return the article numbers, I used:
preg_match_all('/\d+/', $novalinhas, $matches);
$artigo = (int)implode('',$matches[0]);
It's working, however, in some articles it takes more numbers than the article, but it does not capture all the numbers in the string.
For example in this article below his id is article2040827.
Art. 2.040. The legal mortgage of the property of the tutor or curator, registered in accordance with item IV of art. 827 of the previous Civil Code, Law no. 3,071, of January 1, 1916, may be canceled, obeying the provisions of the sole paragraph of art. 1.745 of this Code.
I tried to use
[0-9] +. [0-9] + // Before art. 100, only article0 mark, and after 999, only mark article1
Note: Articles have variations of:
Art. 1º until Art. 2,023.