Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have this line of code (a one-liner to import the Abaqus dispalcements!)

displacements = 
 DeleteCases[
   ImportString[
    StringCases[fileStr, 
      RegularExpression[
        "------------------------------\n([.\\s\\S]*)Minimum"] -> \
{"$1"}][[1, 1]], "Table"], {}][[
  All, {1, 3, 4}]];(* drop the 2nd column = U.Magnitude *)

This line gives a trouble in the auto-intendation when sometimes the * ) in the RegularExpression matches with an opening (* somewhere earlier.

One solution to correct the wrong formatting (I know) is to delete the *) and retype it.

Anyone else faces such trouble in the front-end? Any way to avoid it?

I am on M8

share|improve this question
add comment

1 Answer

I don't think you can avoid completely it since comments behave like:

Here is code (* comment " comment *) more code

But you can split the string up:

"part1*)part2" == "part1*"<>")part2"

Unrelated observations:

Although I do find it strange you can't escape "*" nor ")" with "\"

"\)" != ")"
"\)" != "\\)" (* Theese  two print as the same *)
StringMatchQ["\)", "\\)"] (* False *)
StringTake["\\)", {1}]    (* "\\" *)
StringTake["\)", {1}]     (* "\)" huh? *)
ToCharacterCode["\)"]     (* {63424} something in unicode PUA *)
""=="\)"                 (* True, displays as "\)"=="\)" on input *)
FullForm[\( 1 \)]         (* "1" *)

What is this \( \) thing? EDIT: nevermind, it's RowBox

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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