Quantcast
Browsing all 186 articles
Browse latest View live

Intra-Symbolic Wild Card Pattern Matching

I have the following custom expression structure I am parsing:Theorema`Knowledge`Q$TM[ Theorema`Language`VAR$[Theorema`Knowledge`VAR$x$TM]]I already was able to match the inner structure so that I can...

View Article


Rule-based deletions from string list

I have a list of strings:lis = {"a","b","c","12","d","q","r","X","s"}I'd like to delete list members starting with "X" moving backwards through the list from "X" until a list member that's a digit...

View Article


Coverting .nb file code content to string type using NotebookImport

For my work I need to import the notebook and get all the contents from the code cell. For this task I chose ToString/@NotebookImport[file,"Input"->"HoldExpression"]."Input"->"HoldExpression" is...

View Article

How to define a mixed pattern consisting of string and regular patterns for...

I'm kinda stuck here, and I could really use some help:I want to define a function, let's call it quarterValue, that accepts a Rule as an input and returns an appropriate expression as output.A...

View Article

How to search text for a specific word? [closed]

I have a list of text where each position contains a sublist with a length of 12 elements.I'm trying to search for a word can be appears in the first position of each sublist. The desired output is to...

View Article


Splitting a list by specifying section headers

I have a list of strings called mylist:mylist = {"[a]", "a", "a", "[b]", "b", "b", "[ c ]", "c", "c"};I would like to split mylist by "section headers." Strings that begin with the character [ are...

View Article

How to extract a consecutive list of substring from a string?

Given a list of strings:data = {"2894;Hot Pink;53:09:44;1449714","17456;Dark Cyan;19:06:42;6929227","5147;Lime;54:11:55;5247632"}(Words are separated by ";", the number of words in strings are equal....

View Article

Match sequence of zero or more characters except a given character

This looks like it should be simple: I want to match an "i" followed by an "o" with an arbitrary (possibly zero-length) sequence of characters in between, unless that sequence also contains an "i"....

View Article


Convert String to List of Numbers

I want to create a function that when a string is entered it will turn it into a list of numbers, these numbers are the numerical form of the characters in the string.e.g. a=1, b=2, c=3, d=4 and space...

View Article


Elegant and fast way to join all string sequences

I want to do what title says:{"a","b",1,2,3,4,"a",2,2,2,"edg","?"} => {"ab",1,2,3,4,"a",2,2,2,"edg?"}in the most elegant way. For example one replacement rule for ReplaceAll.I have manage to do...

View Article

Find the position of a string element, knowing only part of the string

I have a list, e.g.:list = {1, 2, 3, "Element 1", 4, 5, "Element 2", "Something else 1", "etcetera"}Now, I want all elements starting with "El". Using Position, I could find the position of e.g....

View Article

Swap first and last names in a list

Edited to fix an inconsistency in the given example data format.I'm trying to write a simple function to load in a csv list of names which is formatted as "Lastname Firstname Initial " and convert it...

View Article

Converting a string containing whitespace-delimited numbers to a list of numbers

Suppose I have a string str that contains only whitespace-delimited real numbers:str = " 0\t1.46604\t1.44829\t12.0546\t1.57075\t1.64044\t12.0489\t1.58142";I would like to convert str to a list of real...

View Article


Image may be NSFW.
Clik here to view.

How to convert RowBoxes into list of math expressions?

I have following RowBox which represents Step By Step solution of undefined integralRawBoxes[StyleBox[FormBox[StyleBox[GridBox[((StyleBox[GridBox[((Cell[TextData[(StyleBox['Take the integral:',...

View Article

Isolating characters in a string

I'm struggling to find the right function in mathematica to isolate specific characters in a string. I have got a formula as string (I imported it from an excelfile) like this: y = 0.97*x1 + 0.521*x2 -...

View Article


Removing non-word characters in certain parts of a string

I would like to ask how I can remove non-word characters from a string, but only in certain cases.I have read this article, so I know how to get the words out of a string. My text is however a bit more...

View Article

how to extract the string using regular expressions

I have the list :a1 = {"struct name1 {","struct name2{","struct name3{","struct name4{","struct name5{","struct lastStruct{"}I tried to extract the struct names "name1",..."lastStruct" with this but I...

View Article


How to convert the element into Grid

I got the html source code for this element for this page in Wikipedia:<table class="wikitable"> <tbody><tr> <th><a href="/wiki/Hermann-Mauguin_notation" class="mw-redirect"...

View Article

How can I generate a list of combinations of string joins?

Suppose I have the string lists {'a','b','c'} and {'1','2','3'}. How do I get Mathematica to generate the list {'a1','a2','a3','b1','b2','b3','c1','c2','c3'}?

View Article

Deleting all characters in a string that do not belong to a small set of...

Say I have a string {100 aa bbc%j%b%wa ajjcj11j0%2wj fc} with a lot of undesired characters or spaces in it, for example: {"", "%", "w", "j"}. I'd like to strip the string of these characters, with the...

View Article
Browsing all 186 articles
Browse latest View live