Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Friedrich Rentsch
On 06/15/2018 12:37 PM, Ganesh Pal wrote: Hey Friedrich, The proposed solution worked nice , Thank you for the reply really appreciate that Only thing I think would need a review is if the assignment of the value of one dictionary to the another dictionary if is done correctly ( lines 17

Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Nathan Hilterbrand
On Wed, Jun 13, 2018 at 4:08 AM, Ganesh Pal wrote: > Hi Team, > > I wanted to parse a file and extract few feilds that are present after "=" > in a text file . > > > Example , form the below line I need to extract the values present after > --struct =, --loc=, --size= and --log_file= > > Sample

Re: Regex to extract multiple fields in the same line

2018-06-15 Thread Ganesh Pal
> {'struct': 'data_block', 'log_file': '/var/1000111/test18.log', 'loc': > '0', 'size': '8'} > > MARB, as usual the solution you you look nice, Thanks for the excellent solutions >>> regex = re.compile (r"--(struct|loc|size|mirror|l og_file)\s*=\s*([^\s]+)") >>> regex.findall (line) [('struct

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Friedrich Rentsch
On 06/13/2018 07:32 PM, Ganesh Pal wrote: On Wed, Jun 13, 2018 at 5:59 PM, Rhodri James wrote: On 13/06/18 09:08, Ganesh Pal wrote: Hi Team, I wanted to parse a file and extract few feilds that are present after "=" in a text file . Example , form the below line I need to extract t

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread MRAB
On 2018-06-13 18:32, Ganesh Pal wrote: On Wed, Jun 13, 2018 at 5:59 PM, Rhodri James wrote: On 13/06/18 09:08, Ganesh Pal wrote: Hi Team, I wanted to parse a file and extract few feilds that are present after "=" in a text file . Example , form the below line I need to extract the valu

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Ganesh Pal
On Wed, Jun 13, 2018 at 5:59 PM, Rhodri James wrote: > On 13/06/18 09:08, Ganesh Pal wrote: > >> Hi Team, >> >> I wanted to parse a file and extract few feilds that are present after "=" >> in a text file . >> >> >> Example , form the below line I need to extract the values present after >> --

Re: Regex to extract multiple fields in the same line

2018-06-13 Thread Rhodri James
On 13/06/18 09:08, Ganesh Pal wrote: Hi Team, I wanted to parse a file and extract few feilds that are present after "=" in a text file . Example , form the below line I need to extract the values present after --struct =, --loc=, --size= and --log_file= Sample input line = '06/12/2018 11

Regex to extract multiple fields in the same line

2018-06-13 Thread Ganesh Pal
Hi Team, I wanted to parse a file and extract few feilds that are present after "=" in a text file . Example , form the below line I need to extract the values present after --struct =, --loc=, --size= and --log_file= Sample input line = '06/12/2018 11:13:23 AM python toolname.py --struct=d