Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

i have need to split string, by regex: split digits together split letters together [ each part should contain between 3-5 chars RANDOMLY ] so if i have: '...
mr.baby123's user avatar
  • 2,322
0 votes
0 answers
25 views

I have this code for current url: $core = preg_split('@/@', str_replace($_SERVER['DOCUMENT_ROOT'], '', realpath(dirname(__FILE__))), NULL, PREG_SPLIT_NO_EMPTY); On php 8.1.x the problem in this line ...
user3673405's user avatar
0 votes
0 answers
71 views

We receive HTML blood files for clients and I am trying to finish some PHP code to strip, clean and preg strip the code so that I can assemble multiple files into a spreadsheet. The issue is that the ...
nathanhunt79's user avatar
1 vote
1 answer
70 views

I have string with hyphens: $str = `Res TP/1.1 101 Switching Protocols Upgrade: websocket Sec-WebSocket-Version: 13 Connection: Upgrade Sec-WebSocket-Accept: dlnHlWqQ4h57DuALMOjKJmxbNn8= Server: ...
Вячеслав Предеин's user avatar
-2 votes
1 answer
51 views

I have a string that I want to split like this: Sinn.und.Sinnlichkeit.1995.German.DL.1080p.BluRay.x264-RSG <--- Original string Sinn.und.Sinnlichkeit.1995.German.DL.1080p.BluRay.x264 <--- no ...
Daniel's user avatar
  • 11
0 votes
1 answer
77 views

How can I convert this numbered paragraph into an array of sentences? 1. The best foods for your cat's diet 2. How to ensure your cat is getting enough nutrients 3. The importance of a balanced diet ...
نور's user avatar
  • 1,547
1 vote
3 answers
84 views

I have an array (converted from a string) that contains words with non-standard letters (letters not used in English, like ć, ä, ü). I don't want to replace those characters, I want to get rid of the ...
Astw41's user avatar
  • 386
0 votes
1 answer
51 views

I wanna print the first two words of a sentence, $txt = "Laravel PHP Node JS"; and expecting the output Laravel PHP used below snippet is there any other way to simplify it? echo (implode(...
OutForCode's user avatar
1 vote
1 answer
67 views

i am trying split my multi SQL by preg, but it doesn works... Code: $multiSql = " ALTER TABLE `my_table` CHANGE `typ` `typ` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0=none; 1=test1; 2=test2;...
JeyC0b's user avatar
  • 35
2 votes
3 answers
140 views

I have been scratching my head on this but cannot work out a solution. Let's say you have a text of 5000 characters, I would like to split it into blocks of less than 500 characters, but, without ...
Benny's user avatar
  • 460
0 votes
1 answer
63 views

The problem I am having is the string may start with a quote. The pattern is ,<true|false>,,,,,, Some the numbers with decimals can be negative or positive. The final array I need looks like ...
Frank Parks's user avatar
0 votes
3 answers
269 views

How i can take the value only inside the double quotes with preg_split function from this example string $String = '["number","1","2470A K18-901","PEDAL ASSY, GEAR ...
Johan Nes's user avatar
  • 281
0 votes
3 answers
402 views

I need to split a string by number and by spaces but not sure the regex for that. My code is: $array = preg_split('/[0-9].\s/', $content); The value of $content is: Weight 229.6104534866 g Energy 374....
Chris Tannetta's user avatar
0 votes
2 answers
81 views

I am practising with the AdventureWorks database for now and I will be receiving strings like the following: SalesOrderNumber=SOH123 and CustomerID=1. The strings may not always contain =, as they ...
ted_snik's user avatar
1 vote
2 answers
327 views

I split a string by comma, but not within parathesis, using preg_split. I came up with preg_split('#,(?![^\(]*[\)])#',$str); which works perfectly unless there is a comma before a nested parenthesis. ...
Googlebot's user avatar
  • 15.8k
0 votes
1 answer
161 views

I am trying to extract a part of the string 0044800 999999 at the first occurrence of a non-zero. I am using preg_split() thus: $str = preg_split("/[1-9]/", "0044800 999999", 2); ...
user627341's user avatar
5 votes
4 answers
807 views

I have a string like aa | bb | "cc | dd" | 'ee | ff' and I'm looking for a way to split this to get all the values separated by the | character with exeption for | contained in strings. The ...
Xiidref's user avatar
  • 1,531
2 votes
4 answers
81 views

I have the following data which is displaying as this {123456 123456 123456} {654321 654321 654321} {123456 123456 123456} My PHP Code: $myarray = preg_split("/(\s|{\s)/", $data); ...
thebest man's user avatar
2 votes
1 answer
196 views

I am working with below code in php to show the arabic letters in roman ABCD characters as defined below in my code. But it is not displaying properly. It is losing the character sorting also and not ...
usman610's user avatar
  • 519
1 vote
4 answers
50 views

my first question, so please be patient with me... I have this string: "Create a script which will take a string and analyse it to produce the following stats. Spicy jalapeno bacon ipsum dolor ...
KarenS's user avatar
  • 49
1 vote
1 answer
268 views

I have a txt file with this format: 14/12/2020 12:02:50 LOG_HERE_1 XXXXX 14/12/2020 12:04:55 LOG_HERE_2 XXXXX 14/12/2020 12:10:33 LOG_HERE_3 XXXXX And I need to parse it, using a regexp on the ...
Nicolas Manzanos's user avatar
2 votes
2 answers
106 views

Let's say I have this string: 1 + 2 * (3 + (23 + 53 - (132 / 5) + 5) - 1) + 2 / 'test + string' - 52 I want to split it into an array of operators and non-operators, but anything between the () and ' ...
Acsrel's user avatar
  • 35
1 vote
2 answers
228 views

I'm using regex in preg_split to split a string into separate parts. $string = 'text required name="first_name" label="First Name" column="1/2"'; $ps = preg_split("/\...
The Bobster's user avatar
0 votes
1 answer
86 views

I have an array with a list in an array and I have to split to find next a value $artista_inserito = 'DEN HARROW'; $tutti_artisti_data_ora = [ ['time_artisti' => '18:31:00', 'artista_artisti' =&...
pette's user avatar
  • 87
1 vote
3 answers
326 views

I'm looking for a way to split the following string after each set of numbers using regex. I am fairly new to this and I'm having a hard time understanding how to use the correct regex format. $...
John Coleman's user avatar
2 votes
3 answers
954 views

I am trying to split this string into numbered lists.. str options is "Hello,Howdy,Hola". I need the output to be Hello Howdy Hola This is my code $newstr = 'My values are' . explode("...
user6345655's user avatar
0 votes
0 answers
982 views

I'm using a Wordpress plugin called Formidable Forms, but that shouldn't be a hindrance to this question. There's a PHP Hook (https://formidableforms.com/knowledgebase/frm_setup_new_fields_vars/#kb-...
boxPhresh's user avatar
1 vote
1 answer
85 views

I'm hoping that there's some way in regex to match certain characters by counting from right to left. I have a text like the one below where the fields are inconsistent, except that they are delimited ...
Altimus Prime's user avatar
-2 votes
2 answers
121 views

I have filenames like: 1234_56_78 A_FAIRLY_SHORT_TITLE_D.pdf Luckily, the file naming is pretty consistent, but I can't absolutely guarantee that someone didn't use a space where they should have ...
Strawberry's user avatar
0 votes
2 answers
562 views

<?php // This is my string $input = "Lorum ipsum [tag=foo]dolor[/tag] sit [tag=bar]amet[/tag] consectetur adipiscing elit."; // This is my pattern $pattern = "~\[tag=(.*?)\](.*?)\[/...
Wouter Dorgelo's user avatar
1 vote
1 answer
44 views

I have the following string, and want to split the name from the invoiceid. The name could have a space, and possibly a hyphen as well. $invoice_id ="May-Ann Jane-28188-1600086909"; $...
SilverNodashi's user avatar
0 votes
1 answer
108 views

If I use preg_split() function for example: $string = 'products{id,name},articles{title,text}'; $arr = preg_split('/\}\,(\w)/', $string); print_r($arr); I receive the following result: Array ( [0] =&...
stckvrw's user avatar
  • 1,829
1 vote
1 answer
81 views

Regular exp = (Digits)*(A|B|DF|XY)+(Digits)+ I'm confused about this pattern really I want to separate this string in PHP, someone can help me My input maybe something like this A1234 B 1239 ...
Super Man's user avatar
0 votes
3 answers
219 views

I have some changelog text in a string and I would like to split each changelog entry into an array. Here's an example of the changelog text in a variable - $changelog_txt: version 4.4.6 ( updated ...
Mat's user avatar
  • 1,011
1 vote
1 answer
40 views

I split a string by a set of characters as $str = 'a-1 90 b55 0 -4 4 c9'; $array = preg_split('#(?<=[abc])#',$str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); it preserves the delimiter ...
Googlebot's user avatar
  • 15.8k
1 vote
2 answers
199 views

I'm trying to format the following file; [30-05-2013 15:45:54] A A [26-06-2013 14:44:44] B A [26-06-2013 14:44:44] C A [26-06-2013 14:43:16] Some lines are so large, they take multiple lines, so ...
0stone0's user avatar
  • 45.5k
0 votes
1 answer
112 views

I'm trying to use one script for keyword density. Everything works except for foreign letters (be it swedish, Estonian, or anything else). $file includes the text. Here's where the problem comes in: ...
mediacurse's user avatar
2 votes
3 answers
432 views

How to split string by slash which is not between numbers? I am using preg_split function below: $splitted = preg_split('#[/\\\\\_\s]+#u', $string); Input: "925/123 Black/Jack" Splitted result now: ...
Jackson's user avatar
  • 23
0 votes
4 answers
286 views

I want to use preg_split() with its PREG_SPLIT_OFFSET_CAPTURE option to capture both the word and the index where it begins in the original string. However my string contains multibyte characters ...
Phil Gyford's user avatar
  • 15.2k
1 vote
3 answers
552 views

Whith this code I'm trying to split a string in the "//" but it only gives me a value on the $splits[1] and on the $splits[0] gives me nothing. while($row = $result->fetch_assoc()) { $...
Guilherme Silva's user avatar
0 votes
0 answers
36 views

I have a set of single or pair numbers as 9 (9) -8 (-8) 1.1-2 (1.1 and 2) -1-.2 (-1 and 0.2) -1--3 (-1 and -3) 1--2 (1 and -2) I want to split them to an array of two elements, as the second element ...
Googlebot's user avatar
  • 15.8k
0 votes
0 answers
41 views

I'm looking for a regex that matches between square braces but ignores input values. Here is my current code: $matches = preg_split( '#\[([a-zA-Z0-9\._]+)\]#', $content, ...
Leigh Bicknell's user avatar
-1 votes
1 answer
577 views

I used preg_match but its returning pdf as it English that's why may be. But I want to get only 練馬春日町Ⅳ Is there any way to detect it for mb string. <?php // Initialize a sentence to a variable ...
Lemon Kazi's user avatar
  • 3,319
0 votes
2 answers
447 views

I need to split this format of strings CF12:10 into array like below, [0] => CF, [1] => 12, [2] => 10 Numbers and String of the provided string can be any length. I have found the php ...
Casper's user avatar
  • 1,539
-1 votes
3 answers
509 views

I have a series of strings in the form of 10a99b5c 55 2a3b1 g How can I split the string by the characters (which always appears as a single character between numbers or in the beginning/end of the ...
Googlebot's user avatar
  • 15.8k
2 votes
1 answer
114 views

I'm junior and not at ease with regex, and I'm trying to do a password generator with sentences using regex and preg_split. All is done except one thing, for example the sentence "I've got 2 cats." ...
Marie Selene Bonifacio's user avatar
-1 votes
1 answer
99 views

there is such a line #40: dfgdfhfg fgh dfg hfdgh fghdfg hfdg : dfghdfgh / fghdfgh fdghdfg fghdfghd ghdfghf (just as an example) how can you separate it with a regular expression like this - [0] =&...
zaifat's user avatar
  • 7
-2 votes
1 answer
107 views

I need to split or explode a string. K1123-Food, Apple, Z3456-Egg, Mushroom, M9902-Plant, Soil, Water, Q8876-Medicine, Car, Splitter into something like K1123-Food, Apple Z3456-Egg, Mushroom M9902-...
davykiash's user avatar
  • 1,814
1 vote
3 answers
136 views

I try to split my string into an array. All strings between the calculation signs +/*-: $keywords = preg_split("/[\s,-]*[+-*]+/", "quanity*price/2+tax"); This is what I try to achieve: Array ( [...
peace_love's user avatar
  • 6,523
0 votes
2 answers
109 views

Someone may spot this immediately, but I've been going blind on this search pattern and not sure what I'm missing. // test string $stringToSplit = "I awoke in the dim light of the fire pit surrounded ...
user1604298's user avatar

1
2 3 4 5
12