main_solution5/bfc.scala
changeset 399 b17a98b0c52f
parent 384 6e1237691307
child 404 bf20a9fa5c29
--- a/main_solution5/bfc.scala	Fri Nov 05 17:20:53 2021 +0000
+++ b/main_solution5/bfc.scala	Sat Nov 06 00:06:39 2021 +0000
@@ -170,14 +170,14 @@
 // that is write(mem, mp, 0). 
 //
 // The easiest way to modify a string in this way is to use the regular
-// expression """[^<>+-.\[\]@*#]""", which recognises everything that is 
+// expression """[^<>+-.\[\]""", which recognises everything that is 
 // not a bf-command and replace it by the empty string. Similarly the
 // regular expression """\[-\]""" finds all occurences of [-] and 
 // by using the Scala method .replaceAll you can repplace it with the 
 // string "0" standing for the new bf-command.
 
 def optimise(s: String) : String = {
-  s.replaceAll("""[^<>+-.\[\]@*#]""","")
+  s.replaceAll("""[^<>+-.\[\]]""","")
    .replaceAll("""\[-\]""", "0")
 }