-2
\$\begingroup\$

Your challenge is to parse nonsensical text and output a "congruous phrase" - which I shall define here to be text with any contiguous characters in between, and including, a given set of like symbols removed.

The given set of like symbols (ignore all brackets and commas here, they're only for notation) are: {(< >), (^ ^), (' '), (: :), (% %)}


[NOTE: This question has been heavily refined after several critical errors were identified.]

EXAMPLE 1:

Thi'inquit Caecilius's qu % est provocationem %h^ ad howe et^s [ben] heavilede ^citi:ssim:e^< rn^> ^quolibe doetiguis^dited %inger 'ingenia'%! S__o:esse: rr %^umd^%y...

OUTPUT 1:

This qu hs [ben] heavilede dited ! S__o rr y

.

Be wary of the nested like symbol parts - e.g ^citi:ssim:e^ and < rn^> from above, where the pair : : are sandwiched between another pair ^ ^, and a half-pair ^ in between < >. Both of these non-congruous phrases must be removed.

EXAMPLE 2:

W%cd'fuf'dc%at<>ch^'o'^out!

OUTPUT 2:

Watchout!

.

EXAMPLE 3: Special Case (partial nested like symbols)

aaa^bbb%ccc'ddd^eee%ddd'fff

OUTPUT3: The first occurence of the given like symbol is the dominant; in this case ^

aaaeee%ddd'fff


The code must apply to the general case, so any text of your choosing, of length >= 30 characters, may be used as test cases.

The shortest code, in bytes, that completes this challenge successfully, is the winning code.

\$\endgroup\$
  • 3
    \$\begingroup\$ Scoring on character count is a bad idea. It leads to code that's gibberish packed into multibyte characters that's decompressed and run within the program. \$\endgroup\$ – xnor Nov 10 at 7:18
  • \$\begingroup\$ @JoKing I'm terribly sorry, this gibberish has been corrected; different timezone here, so I wasn't quite myself.. \$\endgroup\$ – john321 Nov 10 at 10:15
  • \$\begingroup\$ @xnor Thanks for pointing that out; it has been corrected to shortest bytes \$\endgroup\$ – john321 Nov 10 at 10:16
  • 1
    \$\begingroup\$ I'm voting to reopen this, but I don't think it is that interesting of a question \$\endgroup\$ – Jo King Nov 10 at 23:57
  • 1
    \$\begingroup\$ Could this be moved to the sandbox (where it probably should have started)? \$\endgroup\$ – ouflak Nov 11 at 8:30
2
\$\begingroup\$

C# .NET, 162 bytes

using System;class A{static void Main(string[] s){Console.Write(System.Text.RegularExpressions.Regex.Replace(s[0],String.Format("([{0}]{{1}}).*?\\1",s[1]),""));}}

Try it online!

Er, the OP's test case is faulty. Either you remove all text between any two symbols, or you remove all text only between like symbols. OP does both in his test case... So I'm doing only between like symbols.

Takes as input the string to search and the character set to use. OP is incorrect about the output, though. It reads,

, Howarm y congruum dor ingqussld...
\$\endgroup\$
  • \$\begingroup\$ Yes, I had meant like symbols, as you managed to somehow figure out from my gibberish; I have updated the question, and the difficulty has slightly increased due to nested like symbols. \$\endgroup\$ – john321 Nov 10 at 10:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.