0

In the text below, I would like to extract the 3 services. However only the second 2 work, since teh Service Name in the first one is blank.

===============================================================================
ServiceId    Type      Adm  Opr  CustomerId Service Name
-------------------------------------------------------------------------------
100          VPRN      Up   Up   1          
2147483648   IES       Up   Down 1          _tmnx_InternalIesService
2147483649   intVpls   Up   Down 1          _tmnx_InternalVplsService
-------------------------------------------------------------------------------
Matching Services : 3
-------------------------------------------------------------------------------

Here is my template

Value Required SERVICE_ID (\S+)
Value Required TYPE (\S+)
Value Required ADMIN_STATE (Up|Down)
Value Required OPER_STATE (Up|Down)
Value Required CUSTOMER_ID (\d+)
Value Required SERVICE_NAME (\S+)

Start
 ^----------- -> Service

Service
  ^${SERVICE_ID}\s+${TYPE}\s+${ADMIN_STATE}\s+${OPER_STATE}\s+${CUSTOMER_ID}\s+(${SERVICE_NAME}\s*|\s+)$$ -> Record
  ^-+ -> Done
  ^=+
  ^Matching\s+Services
  ^\s*$$
  ^. -> Error

Done

1 Answers1

0

The answer that was staring me in the face was the definition of the value which had ‘Require’. Simply strip that and things work like a champ.

Value Required SERVICE_ID (\S+)
Value Required TYPE (\S+)
Value Required ADMIN_STATE (Up|Down)
Value Required OPER_STATE (Up|Down)
Value Required CUSTOMER_ID (\d+)
Value SERVICE_NAME (\S+)

Start
 ^----------- -> Service

Service
  ^${SERVICE_ID}\s+${TYPE}\s+${ADMIN_STATE}\s+${OPER_STATE}\s+${CUSTOMER_ID}\s+(${SERVICE_NAME}\s*|\s+)$$ -> Record
  ^-+ -> Done
  ^=+
  ^Matching\s+Services
  ^\s*$$
  ^. -> Error

Done
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 17 '21 at 10:45