Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
3 answers
75 views

I have a website where users are required to write a simple, short profile description. Some users are writing ugly profiles with a bunch of empty spaces, and excess new lines. It's a lot of work to ...
-7 votes
1 answer
129 views

I want to replace the following hyperlinks dynamically from <a href="/xsearch2?q=some search/21">21</a> to <a href="/xsearch2?q=some search&page=21">21</a&...
-1 votes
1 answer
97 views

I want to highlight my search query on a formatted number. For example: $search_query = '1234'; // or $search_query = '7800'; $formatted_numeber = '12,345,678.00'; Currently my code is: preg_replace('...
0 votes
1 answer
79 views

I have this simple line of php $text = preg_replace("/\\ii(.*?)\\<>/", "<img scr='img/1ドル'>", $text); Where I change II30.jpgII to <img scr='img/30.jpg'>, and it ...
Jorgensen's user avatar
1 vote
0 answers
91 views

So I am currently using this regex, but I see a flaw in it for p and div tags: (<(p?|div?)>).+(\s|&nbsp;)+(<\/(p?|div?)>)+ Given the current string: <div class="blahblahblah ...
0 votes
0 answers
37 views

I'm in the process of upgrading my site's engine. The new version does not support bbcodes, and all my forum posts and articles are created using it. I want to make a script to convert all text with ...
Leks's user avatar
  • 1
4 votes
3 answers
149 views

In PHP I need to highlight multiple given words in a string, for example wrapping found matches inside a <em> tag. But if I have a word ending in + I cannot do it. I understand the below problem ...
0 votes
0 answers
27 views

I have to determine all short tags like [field id="key1"] in the string, get the keys from the short tags to use them to get the values like $fields["key1"], then replace in the ...
user avatar
0 votes
1 answer
123 views

I need a php preg_replace to allow only the first occurence of ' and -, the rest will be removed and no numbers and other special characters. So Mike O' Hara's Du-Pont Check-In will become Mike O' ...
ruzip's user avatar
  • 63
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
75 views

I've been using file_get_contents in php until the last month when it's stopped working. So I've tried using curl but I'm now getting errors when I extract data from the downloaded webpage (finance....
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 = ...
0 votes
2 answers
106 views

I'm trying to create a perl regular expression that matches a URL that is not preceded by an equal sign and one single or double quote (optional) ignoring whitespace. The code below gives an error: ...
0 votes
2 answers
53 views

I have a span tag that has role attr button. What I want to achieve is to remove the whole span while matching not the span itself but the role attribute $str = 'This is a test buton. <span id=&...
lStoilov's user avatar
  • 1,351
-1 votes
1 answer
107 views

I'm looking for a preg_replace that can replace " with ' when between font-family: and ; I'm having an issue with my some dynamic html I'm using which requires me to replace the quotes with ...

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

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