Jump to content

Archived

This topic is now archived and is closed to further replies.

belick

Help with regex...fetching part from string

Recommended Posts

I need to fetch part of a string that can be anyting. The roll is basic:
starting with " dbo." ending with ".(.*) " I think

botom line I need to fetch:  "dbo.AnyTableHere.AnyField" when "AnyTableHere" can be anything etc...


(CASE WHEN dbo.AnyTableHere.AnyField = 1 THEN dbo.T_Trucks.TruckName END)

thanks ahead!!!

Share this post


Link to post
Share on other sites
[code]
<?php
$string = '(CASE WHEN dbo.AnyTableHere.AnyField = 1 THEN dbo.T_Trucks.TruckName END)';
preg_match_all('/dbo\.(.+?)\./', $string, $matches);
array_shift($matches);
echo '<pre>', print_r($matches, true), '</pre>';
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.