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 =
"~({$company_domain}[
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
On Tue, 2010-01-05 at 14:26 +0100, Daniel Egeberg wrote:
> On Tue, Jan 5, 2010 at 14:13, Ashley Sheridan
> 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'
On Tue, Jan 5, 2010 at 14:13, Ashley Sheridan 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.
--
Daniel Egeberg
--
PHP Ge
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 13: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 exten
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 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 ac
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.
> >
> > sp
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 fe
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.
sprintf('%0
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('%0
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
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.
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
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 = '123
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
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, $
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 = substr($number,$len
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 numb
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
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 cou
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 Broadba
-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
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 */
}
$st
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
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:
Of course, there could be some other way...
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 qu
28 matches
Mail list logo