I'm new to R and reg-ex but recently decided to take it up I'm trying to do something which I'm sure should be very simple
I have 2 SQL statements that i have randomly created using two methods. Both are set up differently
The first statement uses Aliases for the table names The second statement uses full names for tables
I have two questions
I want to get a script in R that will remove all the aliases and replace them with the full table name based on the From clause e.g.
SELECT AL1.attr1,AL1.attr2
FROM Table_1 as AL1
Would be turned into
SELECT Table_1.attr1,Table_1.attr2
FROM Table_1
As a second part of my little experiment, I want to be able to segment the fields using regex so for example only selecting AL1.attr1,AL1.attr2 and putting them in a column and a second column would have Table_1 as AL1
I think the second part will almost answer the first part
Any help would be much appreciated
Thanks