Question:
PERL pattern matching / substitution?
Dante
2007-06-25 17:30:13 UTC
I am looking for a pattern / substitution that will accomplish the following results in PERL:

Original:

7:08:48 PM Msg Grp=ba.aig Thd=Thread-75 function one: Processed [5074] advisors.

7:08:48 PM Aud Grp=ss.ug Thd=Thread-55555 function two: Entered: 1182812928325

7:04:06 PM Dbg Grp=ss.sg Thd=Thread-2 CCSNameServiceAgent.getNarrowedObject(): Getting IOR information

Update:

7:08:48 PM function one: Processed [5074]

7:08:48 PM function two:

7:04:06 PM CCSNameServiceAgent.getNarrowedObject(): Getting IOR information


For the first match, the pattern will begin with "Msg", "Dbg" or "Aud"

If the first part is "Aud, Dbg or Msg" whatever in between and end with "-99" where 99 can be a number from one digit to many.

Thanks......
Three answers:
martinthurn
2007-06-26 17:52:52 UTC
Try this for starters and see how it works...



$s =~ s!(Aud|Dbg|Msg).+?Thread-\d+!!;
Bender
2007-06-26 04:35:10 UTC
If I get what you are asking this should be what you want...



$variable =~ s/(Msg|Dbg|Aud)(^\d+)(\d+)//;



I dont have perl on this comp to find out but I'll test it tomorrow and if its wrong you'll hear back from me.
richmond
2016-10-03 07:22:23 UTC
i'm so torn between 2 yet could bypass with the Rock vs HBK. which would be one in each and every of those good tournament! on condition that the two have by no potential fought one yet another until eventually now i could have enjoyed to make certain how they stacked up against one yet another. If no longer that tournament then truthfully the Bret vs HBK Revenge tournament, i could have payed huge greenbacks to make certain that stay. i'm a Shawn AND Bret fan yet lean extra to HBK yet nonetheless it may be large.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...