Write a regular expression to get the value xxx from the
string 'xxx@yyy.com'
Answers were Sorted based on User's Feedback
Answer / bipin
<?php
$string = 'xxx@yyy.com';
list($firstString,$secondString) = split('@',$string);
echo $firstString;
?>
| Is This Answer Correct ? | 9 Yes | 7 No |
Answer / stalin raja.h
<?php
$string = 'xxx@yyy.com';
$sub = substr('$string',0,2);
echo $sub;
?>
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / tclgeek
set url "xxx@yyy.com"
regexp {([^@]+)@([^.]+).([a-z]+)} $url match match1
puts " Match....$match1"
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / arun
set chk "xxx@yyy.com"
if {[regexp {([a-z]+)} $chk match one ]} {
puts $one
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sunil kumar
hello Bipin bhaiya, ur program is right but when I run this
program I encountered an error and i.e.
Deprecated: Function split() is deprecated in
C:\wamp\www\Test\aa.php on line 3
pl.tell me what`s that error
sunilnagpal30@yahoo.in
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ren
set url "xxx@yyy.com"
regexp {([^@]+)@([^.]+).([a-z]+)} $url match
puts " Match....$match"
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / tclgeek.com
set url "xxx@yyy.com"
regexp {(\w+)@.+\.com} $url match
puts "Match is--->$match"
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between Split and Explode in PHP?
What is difference between base_url and site_url?
How do you remove duplicates from an array?
Is php a programming language?
How can we get the browser properties using PHP?
4 Answers Google, Pollux Softech,
How do I get csrf token?
What are the data types in php?
How i can integrate merchant payment get way in zen cart? in php? plz help me
1 Answers BA Continnum Solutions,
Is php still in demand?
Difference among echo, print and printf.
What are string functions?
What is a http session?