Hi,
I'm trying to process a large number of files, each with a very small size (about 500 chars maximum).
I need to retrieve multiple information from each file, and some of these are optional.
So to "simplify" the process, I undefed $/ (variable contains the full file).
The current regular expression that I know works (with all mandatory matches) is the following:
/\{2:[^\}]+(\d{6})\d{4}.\}.*^:25:(.+?$).*^:13D:(\d{6})/sm
as can be seen, there are 3 groups,
the part I wish to make optional is ^:13D:(\d{6})
so I thought just putting (^:13D:(\d{6}))? would be fine (managing the additional group afterwards of course),
but trying out the changed regular expression:
/\{2:[^\}]+(\d{6})\d{4}.\}.*^:25:((.+?$).*^:13D:(\d{6}))?/sm
it seems the last part never contains anything, even when the previous version did manage a match.
Can someone tell me why?
Also, if my approach is not efficient, any comment on how to better do it will be greatly appreciated. :)
Thanks in advance.
P.S.: I've been trying the script on windows [5.8.8] and unix (aix) [5.8.2],