Pattern library/Next-page / pagination link regex
Next-page / pagination link regex
Crawlers often need the next list URL. This starting point looks for rel=next; refine in Forge for site-specific copy like 「下一页」.
Expression
/(?<=rel\s*=\s*['"]next['"][^>]*href\s*=\s*['"])[^'"]+/i
How to read it
(?<=rel\s*=\s*['"]next['"][^>]*href\s*=\s*['"])After rel=next … href quote[^'"]+Full match is the next URL
Sample test
2 match(es)<link rel="next" href="/page/2" /> <a rel='next' href='/items?page=3'>Next</a> <a href="/page/2">Skip me</a>
Starter prompt: extract next page href from HTML pagination