从sql文件中提取表名称的grep中的正面lookbehind

时间:2017-08-03 17:09:34

标签: regex grep

我正在尝试从大量SQL文件中提取表名。模式很简单,任何单词都在FROM或JOIN之后带有空格。

示例输入类似于:

SELECT t1.a,t1.b,t2.c,t2.d,t2.e
FROM TABLE1 t1
JOIN TABLE2 t2 on t1.a = t2.b

我有一个.NET正则表达式模式,可以实现我想要的但我似乎无法将其转换为grep模式。

(?<=FROM\s|JOIN\s)\w+

有关如何使用grep执行此操作的任何建议吗?

1 个答案:

答案 0 :(得分:0)

正则表达式是正确的,您只需要<!-- .Modal Form Edit Rosta --> <div class="modal-header"> <h3 class="modal-title" id="modal-title">Edit Roster</h3> </div> <div class="modal-body" id="modal-body"> <form class="form-horizontal"> <fieldset> <div class="form-group"> <label class="col-md-4 control-label" for="selectDuty">Select Duty</label> <div class="col-md-4"> <select id="selectDuty" name="selectDuty" ng-model="item" ng-options='item in items' class="form-control"></select> </div> </div> <!-- Multiple Checkboxes --> <div class="form-group"> <label class="col-md-4 control-label" for="checkboxes">Multiple Checkboxes</label> <div class="col-md-4"> <div class="checkbox"> <label for="checkboxes-0"> <input name="checkboxes" id="checkboxes-0" value="1" type="checkbox"> Option one </label> </div> </div> </div> <div class="modal-footer"> <!-- Button (Double) --> <div class="form-group"> <!-- <label class="col-md-4 control-label" for="button1id">Double Button</label> --> <div class="col-md-8"> <button id="buttonSave" name="buttonSave" class="btn btn-primary" ng-click="$ctrl.ok()">Save</button> <button id="buttonDelete" name="buttonDelete" class="btn btn-danger" ng-click="$ctrl.delete()" ng-show="false">Delete</button> <button type="button" class="btn btn-basic" ng-click="$ctrl.cancel()">Cancel</button> </div> </div> </div> </fieldset> </form> </div>标志:

-P