/    Sign up×
Community /Pin to ProfileBookmark

Multiple data retrive

hi,
i am new coder in PHP world.
Help me about this problem.

###problem1#################

i want to retrive data from some text.

[B]lasejfsdjfsdf<abc>i want retrive it<efg>sfuhsdfk<abc>again i retrive it<efg>lsdfjosdjf<abc>again & again i retrive it<efg>ksdfjhnsidufh[/B]

i want to retrive data from middle of <abc> & <efg>

###problem1 end#################

###problem2#################

sdnfidvhuiweweonvoiwejhfsdmnvlknweialksfdmiosafjalwfn vihnwieon v

from this line i want to change all [B]v[/B] to as v1, v2, v3,… can i do it?
###problem2 end#################

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@The_Little_GuyOct 30.2006 — for problem 2, I think you need to find the number of times v is in the string, so you can have the 1,2,3,4.... then you would just do a

[B]str_replace("v", "v$numer", $string);[/B]

something like that.
Copy linkTweet thisAlerts:
@NogDogOct 30.2006 — 1:
[code=php]
preg_match_all('/<abc>(.*)<efg>/Us', $string, $matches);
$values = $matches[1];
echo "<pre>";
print_r($values);
echo "</pre>";
[/code]


2:
[code=php]
$counter = 1;
$newString = preg_replace('/v/ie', '"$0".$counter++', $string);
echo $newString;
[/code]
×

Success!

Help @moinuddin102 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...