Hi all!
I'm makin' a scripting language interpreter using PHP. I have this code in that scripting language:
write {Hello, World!} in either the color {blue} or {red} or {#00AA00} and in either the font {Arial Black} or {Monaco} where both the color and the font are determined randomly
(Yes, it's hard to believe but that's the syntax)...
Hello everybody.
[Check My EDIT for better Explanation]
I need some help with a very big string i have.
Its like this:
$big_string = "TinteiroID:1#TinteiroLABEL:HP CB335EE#TinteiroREF:CB335EE#TinteiroMARCA:HP#TinteiroGENERO:Tinteiro Preto Reciclado#TinteiroQUANTIDADE:23#FIMPROD#TinteiroID:4#TinteiroLABEL:HP 51633 M#TinteiroREF:51633 ...
Hello!
I write some easy parser for my page and have some problem with it.
HTML text:
<p>some text</p><p>another text</p>
If I try use something like:
preg_split("#<p>#",$string);
I have a result without <p>, and this is very very bad. (only </p> exist)
Maybe I can split this string to array, but don't remove </p>?
...
Preg_match gives one match.
Preg_match_all returns all matches.
Preg_split returns all splits.
How can I split only the first match?
Example:
preg_split("~\n~",$string);
This is what I want:
array(0=>'first piece',1=>'the rest of the string without any further splits')
...
Does anyone with more knowledge than me about regular expressions know how to split up html code so that all tags and all words are seperated ie.
<p>Some content <a href="www.test.com">A link</a></p>
Is seperated like this:
array = { [0]=>"<p>",
[1]=>"Some",
[2]=>"content",
[3]=>"<a href='www.test.com'>,...
Consider the string 12345aaa. I want to use preg_split() on it so only the numeric part of it will be returned (i.e. 12345). How would I write the regex for it ?
Thank you in advance !
...
Test string:
Organic whole wheat bread, Monterey Jack Cheese (milk, cheese culture, salt), Hormel Natural Ham (salt, turbinado sugar, lactic acid (not from milk)
Desired output:
Array (
[0] => Organic whole wheat bread
[1] => Monterey Jack Cheese
[2] => Hormel Natural Ham
)
I don't mind if the sub-in...
Hi,
I get this warning from php after the change from split to preg_split for php 5.3 compatibility :
PHP Warning: preg_split(): Delimiter must not be alphanumeric or backslash
the php code is :
$statements = preg_split("\\s*;\\s*", $content);
How can I fix the regex to not use anymore \
Thanks!
...
Looking for some help!
I need to split a string at the last occurrence of a space...
e.g. "Great Neck NY" I need to split it so I have "Great Neck" and "NY"
I haven't had a problem using preg_split with basic stuff but I'm stumped trying to figure out how to tell it only to split at the last occurrence! Any help would be appreciate...
Hi All!
EDITED:
need help on split Array
array example:
array (
[0] =>
:some normal text
:some long text here, and so on... sometimes
i'm breaking down and...
:some normal text
:some normal text
)
ok, now by using
preg_split( '#\n(?!s)#' , $text )...
Edit: OK, I can't read, thanks to Col. Shrapnel for the help. If anyone comes here looking for the same thing to be answered...
print_r(preg_split('/([\!|\?|\.|\!\?])/', $string, null, PREG_SPLIT_DELIM_CAPTURE));
Is there any way to split a string on a set of delimiters, and retain the position and character(s) of the delimiter after th...
I have a session variable that contains the following string.
a:2:{s:7:"LoginId";s:32:"361aaeebef992bd8b57cb3e8d";s:8:"Username";s:6:"aaaaaa";}
echo $_SESSION["SecurityAccess_CustomerAccess"];
I am trying to extract the username "aaaaaa".
What combination of unserialize, preg_split or other will get me there fastest?
attempts so far...
Hey guys, I need help on regular expression here.
I want PHP to be able to splits a string in sections of arrays such that a substring enclosed by <%me %> will be in its own slot.
So for example,
Hi there how are <%me date(); %> => {"Hi there how are ", "<%me date(); %>}
Hi there how are you<%me date(); %> => {"Hi there how are you"...
hello,
is there a way to understand the following logic contained in the splitting pattern:
preg_split("/[\s,]+/", "hypertext language, programming");
in the grand scheme of things i understand what it is doing, but i really want a granular understand of how to use the escapes and special character notation. is there a granular exp...
Hello,
I am trying to use (and I've tried both) preg_split() and split() and neither of these have worked for me. Here are the attempts and outputs.
preg_split("^", "ItemOne^ItemTwo^Item.Three^");
//output - null or false when attempting to implode() it.
preg_split("\^", "ItemOne^ItemTwo^Item.Three^");
//output - null or false when att...
I am parsing the input of ls -lb and trying to put each field into an array in PHP.
My input looks something like this:
-rwx------ 1 user.name users 546879 2008-09-05 09:23 Newspaper_Templates.pdf
-rwx------ 1 user.name users 403968 2009-01-12 14:16 P2_05.ppt
-rwx------ 1 user.name users 144896 2009-01-12 14:08 P2.5_Using_CRO...
I have the following input:
a few words - 25
some more - words - 7
another - set of - words - 13
And I need to split into this:
[0] = "a few words"
[1] = 25
[0] = "some more - words"
[1] = 7
[0] = "another - set of - words"
[1] = 13
I'm trying to use preg_split but I always miss the ending number, my attempt:
$item = preg_split("...
Hello ||||overflow crowd :)
I'm afraid I couldn't find an answer anywhere, so here goes:
My code:
$stuff = '00#00#e0#12#ff#a3#00#01#b0#23#91#00#00#e4#11#ff#a2#'; //not exact, just a random example
$output = preg_split('/(?:[a-f0-9#]{12}| ff# )/', $stuff);
My expectations:
Array
(
[0] => 00#00#e0#12#
[1] => a3#00#01#b0#
[...
I was looking to split a string based on a regular expression but I also have interest in keeping the text we split on:
php > var_dump(preg_split("/(\^)/","category=Telecommunications & CATV^ORcategory!=ORtest^caused_byISEMPTY^EQ"), null, PREG_SPLIT_DELIM_CAPTURE);
array(4) {
[0]=> string(34) "category=Telecommunications & CATV"
...
I have a string called $gallery, $gallery is a list of image URLS The image urls are seperated by a semi- colon ;. Example
http://www.website.com/image1.jpg;http://www.website.com/image2.jpg;http://www.website.com/image3.jpg
How can I split this up and place each url in an image tag, I suppose using preg_split?
Thanks
...