re = /(.+):\s*TextConst\s*ENU\s*=\s*'(.*)',\s*ENG\s=\s'(.*)';/m
str = 'Regular Expression No.1 --> (.+):\\s*TextConst\\s*ENU\\s*=\\s*\'(.*)\',\\s*ENG\\s=\\s\'(.*)\';
------------------------------------------------------------------------------------
TxtLineText: TextConst ENU = \'Line %1: \', ENG = \'Line %1: \';
TxtNoLinesToProcess: TextConst ENU = \'There are no lines to process\', ENG = \'There are no lines to process\';
Regular Expression No.2 --> (.+):\\s*TextConst\\s*ENU\\s*=\'(.*)\'\\s*,\\s*ENG=\'(.*)\'\\s*;
-----------------------------------------------------------------------------------
TxtPurchaseWorksheetNosCode : TextConst ENU=\'PURCH WKSH\',ENG=\'PURCH WKSH\';
TxtPurchaseWorksheetNosDescription : TextConst ENU=\'Purchase Worksheet\',ENG=\'Purchase Worksheet\';
TxtPurchaseWorksheetNosStartingNo : TextConst ENU=\'PW000001\',ENG=\'PW000001\';
TxtSalesWorksheetNosCode : TextConst ENU=\'SALES WKSH\',ENG=\'SALES WKSH\';
TxtSalesWorksheetNosDescription : TextConst ENU=\'Sales Worksheet\',ENG=\'Sales Worksheet\';
TxtSalesWorksheetNosStartingNo : TextConst ENU=\'SW000001\',ENG=\'SW000001\';'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html