I have the following in a string variable. From this I need to extract only product name, model name and report number. Please let me know the easiest and best method to do it either through string manipulations or regex or any other .
String:
V V BiCTC TephnologiyiLitd. , R5port no.: BCTC-625987:
FCC.) Part 159 Teet Heport
FCC ID: :94lLi7933L3B/6ELD
I Product Name: I 22-Inch Wheels I
ITrademark: I (fonnnvnu) I
I Model Name : I M00653 I
Prepared For : Cordovan Limited
Address 1 6 Ludington Center, Sarasota, Florida
Prepared By : BCTC Technology Ltd.
Address : 96029 Fulton Junction, Richmond, Virginia, USA
ITest Date: I 16 Jan 2019 - 18 Jan 2019 I
I Date of Report : I 19 Jan 2019 I
I Report No.: I BCTC-625987 I
Hi @Purnima_Sambasivan
To expand upon @ppr’s post and predict your response use these solutions below which won’t capture the “I” at the start and end. Also the “:” moves around.
Take a look at these regex solutions:
(?<=Product Name: )I (.*) I
Use these in 3 Matches activity and use each Output variable in an Assign activity like this:
ProductName = OUTPUTVARIABLE(0).groups(1).tostring
ModelName = OUTPUTVARIABLE(0).groups(1).tostring
ReportNumber = OUTPUTVARIABLE(0).groups(1).tostring
Replace capitals with each Matches output variable.
Thank you so much. Cant we use just ONE matches activity and add all the 3 patterns. What are settings to use? - Literal , advanced …any other? Sorry for these questions but i am a bit new to regex, tried reading through not getting an apt solution.
when i give ProductName = OUTPUTVARIABLE(0).groups(1).tostring
ModelName = OUTPUTVARIABLE(0).groups(1).tostring
ReportNumber = OUTPUTVARIABLE(0).groups(1).tostring
this says , the enum varaible is not initialised
i got the answer… kept 3 matches and works great . I had to use a FOR EACH for the list which i feel is not needed since there is only 1 Item in the list. All the variables are declared with CTRL+K . But this didnt work
OUTPUTVARIABLE(0).groups(1).tostring.
Still figuring out that part. Thanks a ton Mr.Steven.
Instead of a regex how do we do this with String Manipulations? Extracting the same details?