Questions tagged as 'preg-replace'

1
answer

Regex - Replace process time too high

Recently after developing a process, I saw that it was taking an exorbitant 5 ~ 6min to run, something that should take a maximum of 2s, so I started to debug the code with timers to know which process was taking so long to be accomplishe...
asked by 19.08.2015 / 15:36
2
answers

Treat all hexadecimal colors in a .css file using php and regex

I do not know if they can help me but I want to replace the color in "#xxxxxx" format in a CSS through Regular Expression and PHP. I have a function that calculates the color and replaces it with the inverse color. I need to get the CSS and i...
asked by 24.12.2016 / 03:44
1
answer

What are the valid delimiters for preg_ regular expressions?

What are the valid delimiters for regular expressions preg_* ? I know we can use some of these ( / , ~ and # ), as I show in the example below: $numero = '0.12.13'; preg_replace('/\D+/', '', $numero); // string('012...
asked by 28.08.2015 / 14:13
2
answers

preg_replace is cutting letters with accent

$slug = preg_replace('/[^a-z0-9]+/i', '-', trim(strtolower($_POST["titulo"]))); Example: I'm sending: Esse é um titulo de uma página It returns: esse-um-titulo-de-uma-p-gina As you can see, you are cutting the letters wi...
asked by 05.10.2018 / 18:44
0
answers

Replace, tag with attributes for document merging

Hello, I am creating a document that makes it possible to merge through tags, but I will allow the user to add a separator within the tag, because I am doing this, in the case of a qualification of a client my system would do so Qualification...
asked by 27.12.2017 / 11:52
0
answers

Error php to get data from a certain area of a site

Good night I have a code in php to get the data of a certain page, I use the initial model and it works I'm trying to use it in another site like this one in the model but it gives an error:    E_NOTICE: type 8 - Undefined offset: 3 - at line...
asked by 19.03.2016 / 04:18
1
answer

Preg_replace for Preg_replace_callback

I'm having trouble migrating a script of mine that clears characters from a sentence. The preg_replace (deprecated) I use the value and key of the array for the swap, however the preg_replace_callback converts what it finds...
asked by 29.09.2015 / 14:36
1
answer

Link being replaced in the wrong way when using preg_replace

I have an array with regular expressions that I use to replace url's / hashtags on links using preg_replace : $regs = array('!(\s|^)((https?://|www\.)+[a-z0-9_./?=;&#-]+)!i', '/#(\w+)/'); $subs = array(' <a href="$2" target="_blan...
asked by 11.06.2015 / 22:00
1
answer

The / e modifier is deprecated

I'm having this error while generating a report I made here, it will be if someone can help me.    A PHP Error was encountered       Severity: 8192       Message: preg_replace (): The / e modifier is deprecated, use > preg_replace_callba...
asked by 07.12.2016 / 13:13
0
answers

Get the $ 1 preg_replace value inside an array that has an execution of a function inside

Well, I want to change a text from one sentence to another (it's like an encryption) code being used: $dd = array(); $UserInfo = new UserInfo; $search = array( '/log\((.*)\);/' ); $replace = array( 'log("' . $UserInfo->encrypt...
asked by 03.06.2018 / 02:54