Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

preg-match-all

Getting the first image in string with php

January 3, 2024 by Tarik
Categories php Tags image, php, preg-match-all Leave a comment

How to extract a string from double quotes?

September 25, 2023 by Tarik
Categories php Tags double-quotes, php, preg-match, preg-match-all, string Leave a comment

PHP’s preg_match() and preg_match_all() functions

April 26, 2023 by Tarik

preg_match stops looking after the first match. preg_match_all, on the other hand, continues to look until it finishes processing the entire string. Once match is found, it uses the remainder of the string to try and apply another match. http://php.net/manual/en/function.preg-match-all.php

Categories php Tags php, preg-match, preg-match-all Leave a comment

“Unknown modifier ‘g’ in…” when using preg_match in PHP?

December 18, 2022 by Tarik

There is no modifier g for preg_match. Instead, you have to use the preg_match_all function. So instead of: preg_match(“/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/gim”, ….) use: preg_match_all(“/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/im”, ….)

Categories php Tags php, preg-match, preg-match-all, regex Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa