Skip to main content
Filter by
Sorted by
Tagged with
-5 votes
1 answer
96 views

I need to extract the cookie time from a cookie when a user visits the page. The cookie text will be stored in a variable. I'm pretty sure I can do this with preg_match or maybe strpos but I'm not ...
Glen's user avatar
  • 19
1 vote
1 answer
46 views

I have this string: 1 x red 1 x blue 3 x yellow and I want to turn it into: 1 x red 1 x blue 3 x yellow How can I do this please? I have tried using php preg_match but no luck $description = "1 ...
Youri's user avatar
  • 13
0 votes
0 answers
100 views

I have a variable called $value that contains a string with a css expression. It can be a value or a function: rgb( 25, 128, 128 );, transform( -50% -50% );, bottom 50px right 100px;, #198080;, bold;, ...
Tales's user avatar
  • 1,923
1 vote
0 answers
90 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 ...
Solomon Closson C's user avatar
0 votes
2 answers
57 views

I have a bunch of values representing weight... Some of them are ambiguous, like combining weight and external dimensions of the package, and some don't contain the measurement unit. What I want is to ...
James B.'s user avatar
  • 111
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
1 vote
1 answer
416 views

This is how images are output in WordPress: <figure class="no-lazy"><img loading="lazy" class="wp-image-12345" src="apple.jpg" alt="apple">...
Wanderlust Consulting's user avatar
1 vote
0 answers
75 views

I have a form I continue to build on, so that I can keep spam from being sent through. So far, pretty good - in that the only thing now still getting through are single groups of random letters. I ...
HWL1223's user avatar
  • 21
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....
Chris Appleby's user avatar
0 votes
1 answer
52 views

I wrote a preg_match to block spam in my form comments that works fine (this blocks web page URL insertion and 2 phrases, and throws a message, which also stops the send.): $error_message = "&...
HWL1223's user avatar
  • 21
2 votes
2 answers
89 views

I have a string that contains a list of comma separated values. eg: $sitelist = 'SC001rug,SC002nw,SC003nrge'; I'm using preg_match to check if a site is in this string and then return the characters ...
Tom's user avatar
  • 1,640
-1 votes
1 answer
81 views

I have a problem I can't resolve. And I can't have any feedback since I can only run the script directly on a server, without any possible debug. My files are transfered through FTP to a server and I ...
Laurent's user avatar
  • 160
0 votes
3 answers
176 views

I am having issues with allowing all English/Latin based characters (including accents), but disallowing Chinese/Russian characters. The first version I had was as follows: strlen($values['person_name'...
CopperRabbit's user avatar
0 votes
1 answer
55 views

How to get from here: The #quick# brown fox jumps over the #lazy# dog to here: The span-tag quick /span-tag brown fox jumps over the span-tag lazy /span-tag dog ? And sometimes it`s only: The quick ...
Wortuoso's user avatar
0 votes
1 answer
151 views

I am creating php pagination and I want to matching the /page/1 in URL "/product-category/womens-jackets/page/1" If the /page/1 in matched then redirect it to the main URL "/product-...
Amir's user avatar
  • 33
1 vote
1 answer
72 views

I have a preg_match function and I want to block 'MT', but allow 'PMT'. How would I amend this to work as it's picking up the MT in PMT at the moment? Thanks! function wppbc_custom_input_validation($...
Claschy's user avatar
  • 11
0 votes
1 answer
69 views

I've been working on implementing a simple PHP router and have managed to make it work with required parameters. However, I'm struggling to implement optional parameters but I failed. I'll provide the ...
Omar Abdulwahhab's user avatar
1 vote
2 answers
65 views

Sample text: 1. Medium Size +CA $33.00 2. Small Size -CA $4.00 I would like the result to be just 'Medium Size' or 'Small Size' using preg_match So the regex should detect the '-' or '+' sign and ...
Joshua Loo's user avatar
1 vote
1 answer
42 views

I try to capture all information in a string but only the last one is captured. I start with regex and i need some help. The string : correspondent à l'ASIN B00WU8XXXX, mais les attributs suivants ...
Maxime DANJOU's user avatar
1 vote
1 answer
35 views

I need with preg_match_all() to extract all [ANY_TEXT-pb] blocks. My code: $content = 'START Text1 [news-block] text2 [title1-pb] text3 text4 [title2-pb] text5 END'; preg_match_all('/\[(.*?)pb\]/si', $...
lolalola's user avatar
  • 3,821
0 votes
1 answer
46 views

I have html page from old website that has list of some places using below format. <p><b>Ado’s Kitchen &amp; Bar&nbsp; </b>1143 13th St., 720-465-9063; <a href="http:/...
Yogesh Saroya's user avatar
0 votes
0 answers
40 views

Can anybody help me please. I get an url and need to take the last part after -. Example data game-when-no-one-at-xhU8c0dL coins-at-the-desk-1xhz83c example-example-1391340 Result needed xhU8c0dL ...
Dimitrie's user avatar
-1 votes
1 answer
40 views

I have a string, such as "<span class="m-product-data-3__price-value" itemprop="price" content="143.28">XYZZZ</span>" or "<span class="...
Marek Korbus's user avatar
-1 votes
1 answer
33 views

I have a text file and in that text file there is some data goes like John || Sekram JOHN || Doe Lorem || Ipsum now my problem is i dont know where to start but i want to put this data in to tow ...
sameershxd's user avatar
3 votes
1 answer
79 views

I'm trying to create a regular expression with preg_match that can detect a string with the following requirements: Must contain at least 10 characters. There must be at least one of these: / (slash) ...
Ricardo Castañeda's user avatar
1 vote
4 answers
147 views

I have this string: The product title is [title] and the price is [price] and this product link is [link] and I have a variable called $get_product whch contain associated array. Now, I want to ...
Shibbir's user avatar
  • 1,765
0 votes
1 answer
68 views

{"popUp":false,"token":"NS2938f08ubjk765vhjJBKJB78vhjeec1_m1_7"} This is curl response in JSON, and i want to extract token from this JSON response. i used ...
KRISHN4's user avatar
0 votes
3 answers
134 views

It's very late and I think I've been staring at this too long to figure out, but: I have been provided a bunch of raw text where anything within in tildes (~) is a title, and everything else is just ...
indextwo's user avatar
  • 5,955
0 votes
0 answers
19 views

I am trying to use the preg_match function in php to validate a company email. I have done some general email validation using the same function before but in this case i want the pattern to suit ...
jeremiah muchazondida's user avatar
-2 votes
2 answers
137 views

I have this tag on an HTML code: text html [button link="google.com" color="#fff" text="this text here"] rest of html I wish i could have the parameters of this "...
Luiz Jr's user avatar
  • 71
0 votes
1 answer
81 views

To secure a HTML GET method form submission so that users cannot use MySQL wildcards to get the whole table values, I was looking for a list of PHP-MySQL wildcard characters. For example, this GET ...
levent001's user avatar
  • 324
1 vote
2 answers
214 views

I have the following string example: 034a412f500535454e5 Here I would get the 500 out. The search-string has always 8 digits in front and 8 digits behind. The "500" can have a different ...
hamburger's user avatar
  • 1,447
1 vote
1 answer
63 views

I have user input like: $name = 'Alexxxx' Or $name = 'Aaaalex' And I have list of names like: $names = 'Jack Harry Alex Oscar' I need to know that user input contains name from a list, but user can ...
Roman Zenia's user avatar
0 votes
1 answer
65 views

I create a simple script for search words inside a txt file. <?php $search_term = "lorem"; $file = file('textfile.txt'); foreach($file as $line_number => $line){ $row = preg_match('...
Alberto's user avatar
0 votes
0 answers
247 views

I am hosting my laravel 8 project. When I execute the command composer update -v and also other commands with composer in my Ubuntu 18.04.5 LTS server, the errors below are displayed [...
Root's user avatar
  • 1
0 votes
1 answer
151 views

I have an array the elements of which are paths and contain forward slashes and exclamation marks. And I need to inject such an array as regex pattern to preg_match() $url = 'example.com/path/to/!...
stckvrw's user avatar
  • 1,829
-1 votes
1 answer
46 views

I Have This How to get value from ocrTextBox(2552) ???????????? $res='<script> $("#submit_i2ocr").removeAttr("disabled"); $("#tools").show(); var aTag = $("a[...
My MaiL's user avatar
0 votes
0 answers
52 views

I was using some pre-existing open source code and wanted to add a telephone validation to a form. The original code did not have a telephone validation. I tried to mirror the email php validation ...
goldswoj's user avatar
0 votes
1 answer
43 views

I have been trying but not sure where i am wrong $validator = preg_match('/^\(\0\d{1})?\d{8})$/', $phone); if($validator == true) { echo "Valid phonenumber"; } else { echo "...
Sridhar Reddy's user avatar
0 votes
1 answer
824 views

I am trying to set two parameters within my PHP project. One is sortBy and second is orderBy.. I am trying to define the best logic for it using match() expression, available from PHP 8.0 version. $...
jabepa's user avatar
  • 61
0 votes
1 answer
53 views

I am trying to develop a framework using PHP while learning, and came across this logic for URL routing using regex: public static function on($regex, $cb) { $params = $_SERVER['REQUEST_URI']; ...
Henry Code's user avatar
0 votes
0 answers
29 views

I have following JavaScript code with regular expression which is working as expected. var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[\w~@#$%^&*+=`|<>'{}:;,!.?/\\"()\[\]-]{10,99}$/; ...
user1482114's user avatar
0 votes
1 answer
78 views

Hello everyone I made this php code $variablename = "Marron"; $tallas = '#^/' . implode(array("XL", "L", "M", "S", "XS"), '|') . '/#'; if (...
Edu Rafael's user avatar
0 votes
0 answers
33 views

I want to delete lang-code(EN/DE/FR/IT/JA/ES) out of a string but i dont know the right expression can someone help me ? the Lang-code string always starts with EN/ and the end is variable i know i ...
LeGerman's user avatar
0 votes
1 answer
37 views

I’m trying to extract three parts with a regular expression. It works for the controller and the id but not for the slug, I can not remove the last - <?php $url = "/cockpit/posts/my-...
devitdc's user avatar
2 votes
1 answer
57 views

Here I am having one preg [-0-9a-zA-Z \/_:.,;=\'{0,2}"{0,2}\s]+$ With this I want to check lines whether they contains Alphabets, Numeric and some special character such as - _ , . ; ' " / =...
be MrZulf's user avatar
  • 430
0 votes
1 answer
327 views

Basically I was trying to preg_match all Letters and special letters for example: ä,â,ã… But I‘ve come across to a problem. Preg_Matching only letters was pretty easy since you only need the following ...
NamingHH's user avatar
0 votes
0 answers
92 views

I'm trying to see if a string contains only alphanumeric characters or hyphens Right now I have this code to check for alphanumeric if (ctype_alnum($string)) { //do something } and have tried ...
cpcdev's user avatar
  • 1,224
0 votes
1 answer
119 views

I am trying to create an input field to input the amount. If the amount is less than 200 it will show the error message. This is the code: <?php $paid_amount = sanitize_text_field( $_POST['...
Tanvir Roky's user avatar
1 vote
2 answers
371 views

I am struggeling with reading a GS1-128 barcode, and trying to split it up into the segments it contains, so I can fill out a form automatically. But I can't figure it out. Scanning my barcode gives ...
MauiRiis's user avatar

1
2 3 4 5
108