Here is the regex for you.
$company_domain = '\w+'; // replace with your own company domain pattern.
$user_name = '\w+'; // replace with your own username pattern
$email_domain = '\w+\.\w{2,4}'; // google for standard domain name
regex pattern and replace it.
$regexp =
I'm not a regexp person (wish I was though), and I'm hoping someone can give
me a hand here. Consider the following strings:
- domain\usern...@example.org
- domain\username
- the same as above but with / instead of \ (hey, it happens)
-
Op 3/15/10 1:54 AM, Ashley M. Kirchner schreef:
I'm not a regexp person (wish I was though), and I'm hoping someone can give
me a hand here. Consider the following strings:
- domain\usern...@example.org
- domain\username
- the same as above but with /
Hi all, first time I have posted here so please be nice.
I am using PEAR HTTP_Upload to handle multiple file uploads. What I need to do
is to take the file name which is output using the getProp() function and then
remove the file extension from the end of the file for example:
Original name
On Tue, Jan 5, 2010 at 13:39, Ingleby, Les les.in...@tynemet.ac.uk wrote:
Hi all, first time I have posted here so please be nice.
I am using PEAR HTTP_Upload to handle multiple file uploads. What I need to
do is to take the file name which is output using the getProp() function and
then
On Tue, 2010-01-05 at 12:39 +, Ingleby, Les wrote:
Hi all, first time I have posted here so please be nice.
I am using PEAR HTTP_Upload to handle multiple file uploads. What I need to
do is to take the file name which is output using the getProp() function and
then remove the file
On Tue, Jan 5, 2010 at 14:13, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
(untested - I always forget the order of the params!)
As a general rule, string functions are always haystack-needle and
array functions are always needle-haystack. I can't think of any
exceptions to that rule.
--
On Tue, 2010-01-05 at 14:26 +0100, Daniel Egeberg wrote:
On Tue, Jan 5, 2010 at 14:13, Ashley Sheridan a...@ashleysheridan.co.uk
wrote:
(untested - I always forget the order of the params!)
As a general rule, string functions are always haystack-needle and
array functions are always
On Thursday 16 November 2006 01:12, Robert Cummings wrote:
On Thu, 2006-11-16 at 10:47 +1100, Chris wrote:
Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0 in front of the number
to add if the string is less than 5 chars short.
sprintf is your
On Thursday 16 November 2006 01:38, Paul Novitski wrote:
At 11/15/2006 02:06 PM, Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0
in front of the number to add
if the string is less than 5 chars short.
I forgot to mentinon that the string actually could
On Thursday 16 November 2006 01:38, Paul Novitski wrote:
If you need to left-pad with zeroes, PHP comes to the rescue:
http://php.net/str_pad
However, if you're using the regular expression
method then you might not need to pad the
number. You can change the pattern from this:
On 15/11/06, Aaron Koning [EMAIL PROTECTED] wrote:
Assuming var1 and var2 only ever use the last four numbers (untested):
$length = strlen($number); // get string length
$var1 = substr($number,0,$length-4); // get number until only 4 numbers are
left
$var2 = substr($number,$length-4,2); // get
On Wednesday 15 November 2006 06:24, you wrote:
At 11/14/2006 03:17 PM, Børge Holen wrote:
$number = 123456789
should print as following:
var1: 12345 (and it is this lengt witch varies)
var2: 67
var3: 89.
You can also do this with a regular expression:
$iNumber = '123456789';
On Wednesday 15 November 2006 12:42, Robin Vickery wrote:
On 15/11/06, Aaron Koning [EMAIL PROTECTED] wrote:
Assuming var1 and var2 only ever use the last four numbers (untested):
$length = strlen($number); // get string length
$var1 = substr($number,0,$length-4); // get number until only
Oh this was good.
I added a while loop to insert extra strings 0 in front of the number to add
if the string is less than 5 chars short.
I forgot to mentinon that the string actually could be shorter (just found
out) and the code didn't work with fewer than 5 char strings.
But now is rocks.
Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0 in front of the number to add
if the string is less than 5 chars short.
sprintf is your friend here, no need to use a loop.
sprintf('%05d', '1234');
--
Postgresql php tutorials
http://www.designmagick.com/
On Thu, 2006-11-16 at 10:47 +1100, Chris wrote:
Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0 in front of the number to
add
if the string is less than 5 chars short.
sprintf is your friend here, no need to use a loop.
sprintf('%05d', '1234');
Robert Cummings wrote:
On Thu, 2006-11-16 at 10:47 +1100, Chris wrote:
Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0 in front of the number to add
if the string is less than 5 chars short.
sprintf is your friend here, no need to use a loop.
At 11/15/2006 02:06 PM, Børge Holen wrote:
Oh this was good.
I added a while loop to insert extra strings 0
in front of the number to add
if the string is less than 5 chars short.
I forgot to mentinon that the string actually could be shorter (just found
out) and the code didn't work with
This numer has dynamic lenght, witch is the root of my problems.
$number = 123456789
should print as following:
var1: 12345 (and it is this lengt witch varies)
var2: 67
var3: 89.
I've been using substr with negative numbers to fetch the last two vars.
thereafter explode to get the first
What's the code?
-D
On Nov 14, 2006, at 4:17 PM, Børge Holen wrote:
This numer has dynamic lenght, witch is the root of my problems.
$number = 123456789
should print as following:
var1: 12345 (and it is this lengt witch varies)
var2: 67
var3: 89.
I've been using substr with negative
Assuming var1 and var2 only ever use the last four numbers (untested):
$length = strlen($number); // get string length
$var1 = substr($number,0,$length-4); // get number until only 4 numbers are
left
$var2 = substr($number,$length-4,2); // get 3rd and 4th last numbers.
$var3 =
At 11/14/2006 03:17 PM, Børge Holen wrote:
$number = 123456789
should print as following:
var1: 12345 (and it is this lengt witch varies)
var2: 67
var3: 89.
You can also do this with a regular expression:
$iNumber = '123456789';
$sPattern = '/(\d+)(\d{2})(\d{2})$/';
preg_match($sPattern,
In PHP 5 there is a awesome function called str_split, is there an equivalent in PHP
4.x?
I need to do the following:
Split a 60 character string into 3 20 character array chunks.
using str_split I could easily do it, but how do I do it in PHP 4.x?
Thanks,
Brent
On Fri, 30 Jul 2004 02:44:19 -0500, Brent Clements
[EMAIL PROTECTED] wrote:
In PHP 5 there is a awesome function called str_split, is there an equivalent in PHP
4.x?
I need to do the following:
Split a 60 character string into 3 20 character array chunks.
using str_split I could easily
On Friday 30 July 2004 15:44, Brent Clements wrote:
In PHP 5 there is a awesome function called str_split, is there an
equivalent in PHP 4.x?
I need to do the following:
Split a 60 character string into 3 20 character array chunks.
using str_split I could easily do it, but how do I do it
I have a CSV file that has 7 fields. One of the fields has a number, and
some of the numbers start with a S. If that number start with a S, I
want to strip it off. I am not sure how to do that. I first wrote the script
to open the file, load each line into an array and split the array by field.
Hi,
Christopher J. Crane [EMAIL PROTECTED] wrote:
[snip]
If that number start with a S, I want to strip it off.
[/snip]
Why don't you just check whether the first character is an S then
return only the rest of the string if it is? Like:
?php
$my_string = 'S12345';
if ($my_string{0} ==
On Thu, 13 Mar 2003 09:13:35 -0500, you wrote:
Then split the variable where there is a S. The problem showed up when
there is another S in the field. I only want to split the first S at the
beginning of the field. Isn't there an additional value to add to the split
$line = 'S12345';
if
Then split the variable where there is a S. The problem showed up
when
there is another S in the field. I only want to split the first S
at the
beginning of the field. Isn't there an additional value to add to the
split
$line = 'S12345';
if ($line[0] == 'S') {
/* do stuff */
}
$str =
-4379
-Original Message-
From: - Edwin [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 9:30 AM
To: Christopher J. Crane; [EMAIL PROTECTED]
Subject: Re: [PHP] Splitting a string
Hi,
Christopher J. Crane [EMAIL PROTECTED] wrote:
[snip]
If that number start with a S, I want
Hi,
David Rice [EMAIL PROTECTED] wrote:
$str = S12345;
$str1 = ltrim($str,S);
Good idea but you'd have problem if you have $str = SS12345; and you
only want to get rid of the first one...
- E
__
Do You Yahoo!?
Yahoo! BB is Broadband by
I wish to split my databased string in half to be shown on 2 seperate
columns, but also preserve whole words. Is there a function that does this
already? Maybe a quick fix? Hopefully something that doesn't include html
tags as part of the string to split. If it's not that specific then that's
Ok, heres one for y'all
I have the user entering a free formed string (such as a search engine
query).. and i want to parse that string into an array of string elements...
If the user enters elements within double quotes, that would appear as one
entity.. for each word outside of containing
Try this:
first test to see if the query contain quotes, if it
does, go to a seperate routine that splits the string
into an array, first however, you must make sure there
is a space before the query and one after the query (
you add these) *then* split the string into an array,
explode on the
35 matches
Mail list logo