Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
0 answers
84 views

As part of a migration, I wrote a function to transform links, prepending a path ("/my/files") to existing paths from the source site. Here is my function: function example_file_urls($text) ...
0 votes
1 answer
69 views

Get a warning because the e modifier deprecation on preg_replace function. Here is the code, I suggest that should be replaced by preg_replace_callback function (for php 7.4.16) : `$text = ...
-2 votes
1 answer
96 views

I have edited my question and simplified it. I created a function to highlight glossary in text that can be used to highlight conjugated words (in french). I works great but I want to ignore words ...
0 votes
2 answers
94 views

I am learning php language. I want to show the table of contents for the article. Convert the headings (h2,h3,h4,...) into a list and create links. This is my php code. $Post = ' <h2>Title 01<...
0 votes
2 answers
82 views

I have input strings like Wires: 8 Pairs: 4 The both numbers may be different for different strings So, only dividing and only numbers can be different I need to get the output result like Wires: 2 ...
stckvrw's user avatar
  • 1,839
1 vote
0 answers
36 views

An example of what I need: $input = "bar bar bar bar bar"; $result = preg_replace_callback('bar', 'foo', $input); // And there must be some way to limit preg_replace_callback so that it ...
0 votes
1 answer
153 views

Background information: The log file is copied and read out at regular intervals. Log file lines do not have a year specification. Months are continuous. Before January is always the previous year. ...
0 votes
3 answers
277 views

Search in the array for the first occurrence of a string until space, then convert it to month. $arr = [ "May Hello", "Jun Hello12", "Jul 3" ]; $str = $arr[0]; $...
0 votes
2 answers
278 views

I do have that code: ob_start(); include($this->testTpl); $html = ob_get_clean(); $pattern = '/{{{\s*(.+?)\s*}}}(\r?\n)?/s'; echo preg_replace_callback($pattern, function($matches) { return &...
3 votes
2 answers
133 views

I have a couple of "shortcode" blocks in a text, which I want to replace with some HTML entities on the fly using preg_replace_callback. The syntax of a shortcode is simple: [block:type-of-...
1 vote
1 answer
76 views

I'm editing a csv file which contains hidden line breaks. When I apply the following php script, the line breaks are successfully removed from the entire file. $csvFileNew = str_replace(array("\r&...
-4 votes
1 answer
706 views

<?php $string = 'this is just testing <a href="https://twitter.com/blalala/status/1523867438743711744">twitter</a> visit google <a href="https://www.google.com/search?...
2 votes
0 answers
85 views

I am trying to build a "simple" RegEx parser, to generate some templates in my project. I have made this bit of regex to match and parse loops - which seems to be correct and finding ...
-1 votes
2 answers
2k views

I am having difficulty converting below preg_replace() function call preg_replace("/\{(.*?)\}/e", '$1円', $data) to using preg_replace_callback() (because of the removed e modifier in PHP 7....
0 votes
1 answer
212 views

I am upgrading my PHP Application from PHP 5 to PHP 7 for which I am required to replace all the references of preg_replace() function to preg_replace_callback() function. I am having a hard time ...

15 30 50 per page
1
2 3 4 5
...
28

AltStyle によって変換されたページ (->オリジナル) /