belick Posted July 24, 2006 Share Posted July 24, 2006 I need to fetch part of a string that can be anyting. The roll is basic:starting with " dbo." ending with ".(.*) " I thinkbotom 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!!! Link to comment https://forums.phpfreaks.com/topic/15483-help-with-regexfetching-part-from-string/ Share on other sites More sharing options...
effigy Posted July 24, 2006 Share Posted July 24, 2006 [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] Link to comment https://forums.phpfreaks.com/topic/15483-help-with-regexfetching-part-from-string/#findComment-62846 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.