# Tag Info

7

Here is an example of how to work with chemicals the Mathematica way. First we retrieve the entity corresponding to the chemical: Then, if we don't know them by heart, we check out the available properties for chemicals: EntityProperties["Chemical"] This returns a long list of properties. There is one called "element counts" that seems interesting. We ...

6

An attempt at a purely string-processing approach: elem = Alternatives @@ Reverse @ SortBy[StringLength] @ Array[ElementData[#, "Symbol"] &, 112]; chem = StringCases[#, e : elem ~~ n : DigitCharacter ... :> {e, n}] /. "" -> "1" &; chem @ {"Fe3O4", "CH3Cl"} {{{"Fe", "3"}, {"O", "4"}}, {{"C", 1}, {"H", "3"}, {"Cl", "1"}}}

4

So I have a data file, whose contents look like this: (-0.998722569699-0.000124681423362j) (-0.00620217196207+0.0501472284j) (-53.0662993987-543.342932199j) (1837.15+0j) (3.7656639408e-16+0j) (-0.998722569699-0.000124681423362j) (-0.00620217196207+0.0501472284j) (-53.0662993987-543.342932199j) (1837.15+0j) (3.7656639408e-16+0j) ...

4

You are correct, StringCases does not support abbreviated string patterns. Abbreviated string patterns date back to Mathematica version 1. StringExpression was introduced in Mathematica version 5.1, largely obsoleting abbreviated patterns for string manipulation functions. They still remain useful in other contexts such as file and symbol name ...

4

You are not missing anything. The documentation for StringCases does not state that it supports abbreviated expressions while StringMatchQ does. But you can use a string expression. StringCases["MATCH", ___ ~~ "H"] (* {"MATCH"} *)

3

Thanks to andre's comment (where this link is provided), I now see the effect of those delimiters. If I add 2 newlines to the box representation of the cell: Cell[BoxData["\"\<a bc\>\""], "Input", CellChangeTimes->{{3.662918813714031*^9, 3.6629188530623317`*^9}}] and switch back using Shift+Ctrl+E, then the cell look like this: "a bc" But ...

3

It won't happen only at the end of the encoding but rather every 76 characters resulting from the encoding. For many old programs that couldn't handle reading long lines, introducing a newline character was introduced every certain number of characters. In computer science argot this is called text wrapping. I guess that the number 76 of characters comes ...

3

I think this is only a dislay issue: If you set x=3231.432 you also get 3231.42 as a return. However, if you evaluate, say, x-3000 the missing digit (2) will appear again. I guess Mathematica only displays five significant figures (per default). Hope this helps.

2

As discussed in comments, we can get the result directly. StringCases["tthis is a book fine", Repeated /@ {"is", "book", "t"}] {"tt","is","is","book"}

2

That package was written some time ago and has not been maintained. You'll need to make the following changes to the Common.m file in the package: Find this code in the file RemoveCellTags[nb_NotebookObject?NotebookOpenQ, pat_String] := Block[{tags}, tags = NotebookCellTags[nb]//Flatten//Union; tags = Select[tags, StringMatchQ[#, pat]&]; ...

1

1

Example: URLSave @ "http://geniusquotes.org/wp-content/uploads/2014/06/The-quieter-you-become.jpg" Reference: URLSave Tutorial: Web Operations

1

SearchAll[sequence_, search_] := Module[{map}, map = Map[# -> "\!$$\*StyleBox[\"" <> # <> "\",FontColor->" <> ToString@RGBColor[RandomReal[], RandomReal[], RandomReal[]] <> "]$$" & , search]; StringReplace[sequence, map]] SearchAll["CGACATCACCGATGGGGAAGATCGGGCTCGCCACTTCGGGCTCATGA", {"CGA", "CATG"}] // Style[#, ...

Only top voted, non community-wiki answers of a minimum length are eligible