0

This string is an error that comes from an AVAYA phone system. I've been trying to parse this darn string into readable sentences, but I haven't had much luck. Here's the offending string: "cadd hunt-group 109\ne3 0005ff00 d6d8 "34257 " Extension previously assigned; please select another\ne2 0005ff00 c6d5 Group extension must be specified\nt\n"

I've tried Regex "string[] splitCommand = Regex.Split(commandResult, @"\W+");" but that splits into individual words, and the count of words varies depending on the type of error, so I don't think that will work. I've tried splitting on "", "\ne" and a few other things, but I just can't seem to get it.. any ideas?

Thanks!

Dave

DaveM
  • 93
  • 1
  • 5
  • Can you give some context? What is your goal? – LunicLynx Nov 02 '21 at 12:54
  • The codes refer to this document some how: https://downloads.avaya.com/css/P8/documents/100010216 – LunicLynx Nov 02 '21 at 12:57
  • Hi.. the goal is to display an error to the end user that is relatively clean. I'm already able to parse the individual objects and display them to the end user, it's the error that gets sent back like the above.. instead of displaying that entire string, I'd like to parse out the individual error parts. For instance, I'd like to only return: "34257 " Extension previously assigned; please select another" And then: "Group extension must be specified" – DaveM Nov 15 '21 at 13:37

1 Answers1

0

The correct format should probably be:

cadd hunt-group 109
e3 0005ff00 d6d8 "34257 " Extension previously assigned; please select another
e2 0005ff00 c6d5 Group extension must be specified
t

To get this result use:

string s = "<input>";
s.Split("\\n");
LunicLynx
  • 939
  • 1
  • 8
  • 16