Link to home
Start Free TrialLog in
Avatar of Member_2_6478753
Member_2_6478753Flag for United States of America

asked on

php regex extract all matchging from a text

i have the following string variable
                CREATE trigger [dbo].[cgi_sms_d600136_datetime] on  [dbo].[CGI_SMS_d600136]  for insert  as        declare @rec_id   bigint   declare @thedatetime  datetime   declare @thedate  char(8)   declare @thetime  char(6)   declare @reqport1  bigint   declare @recdport  bigint   declare @message1  nvarchar(500)   --declare @message1  nvarchar(200)   --declare @message2  nvarchar(200)   declare @smscode  varchar(20)   declare @msisdn1  varchar(50)   declare @coding  int   declare @count   int   declare @id   int     select @thedatetime = getdate()   select @rec_id  = (select id from inserted)   select @thedate  = str(datepart(yyyy, @thedatetime), 4) + str(datepart(mm, @thedatetime), 2) + str(datepart(dd, @thedatetime), 2)   select @thetime  = str(datepart(hh, @thedatetime), 2) + str(datepart(mi, @thedatetime), 2) + str(datepart(ss, @thedatetime), 2)   select @thedate = replace(@thedate, ' ', '0')   select @thetime  = replace(@thetime, ' ', '0')   select @reqport1 = (select reqport from inserted)   select @message1 = (select ltrim(rtrim(message)) from inserted)   select @msisdn1 = (select ltrim(rtrim(msisdn)) from inserted)   select @recdport = (select recdport from inserted)   select @coding  = (select coding from inserted)     --insert into sms_services.dbo.wc2_registration (reqport,msisdn,message) values(@reqport,@msisdn,@message)  --  --declare @reply  nvarchar(140)  --declare @smscount int    --set @message1 = ' ??? ?? ????? ??????? ????? ???? ????  '  --if exists (select * from alerts.dbo.Smile_Users where msisdn = @msisdn)  -- begin  --  if (@message in ('?','?????','?????','?????'))  --   begin   --    delete from  alerts.dbo.Smile_Users where msisdn = @msisdn  --    set @reply = '??? ?? ????? ??????? ?? ???? ????'  --   end  --  else  --   if  (@message in ('?','??','????','?????','??????'))  --    begin  --     set @reply = '??? ????? ?? ???? ????'  --    end  --   else  --   begin  --    update alerts.dbo.Smile_Users set smscount = smscount + 60, @smscount = smscount where msisdn = @msisdn  --    set @reply = @message1 + ltrim(rtrim(str((@smscount + 60)/2)))+ ' ????'  --   end  -- end  --else  -- begin  --  insert into alerts.dbo.Smile_Users (msisdn, smscount) values (@msisdn, 60)  --  set @reply = @message1 + ltrim(rtrim(str(30)))+' ????'  -- end  --  --INSERT  INTO cgi_sms_services.dbo.cgi_sms_in(msisdn, sms_code, message, reqport, smstype)  -- VALUES (@msisdn, '1000000002',@reply, 84474, 'Alert')       EXEC hservice.dbo.uspReceivemessage   @refid = @rec_id,   @msisdn = @msisdn1, --  varchar(16)   @reqport = @reqport1, --  bigint   @message = @message1 --  varchar(4000)                  

Open in new window



let says $string contains the following codes btw the code brackets
i want to select all matching

EXEC hservice.dbo.uspReceivemessage   @refid = @rec_id,   @msisdn = @msisdn1, --  varchar(16)   @reqport = @reqport1, --  bigint   @message = @message1 --  varchar(4000) 

Open in new window


and insert syntax if is the insert not followed by --

insert into sms_services.dbo.wc2_registration (reqport,msisdn,message) values(@reqport,@msisdn,@message) 

Open in new window


how i can write the php script

note : the table name is not static it will be change from string varialbe to another and same for EXEC command
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial