For questions about the function RegularExpression which is used in string patterns in functions as StringCases, StringReplace, StringPosition,StringCount etc.

learn more… | top users | synonyms (1)

2
votes
2answers
106 views

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 ...
2
votes
1answer
76 views

Regular Expression - for html objects

I did a previous research about similar questions, but I really am confuse about using html objects. I have the following situation: I Import a html from a url and I need to pick the numbers that ...
0
votes
1answer
86 views

What does the expression “Total[funca[a,#] & /@ #] & /@ {x,y}” possibly mean?

Can the expression be simplified as "Total[funca[a,#]] & /@ {x,y}"? What does the double of "& /@" mean? Where can I find some reference? Updated According to Mr.Wizard's answer, I now know ...
0
votes
2answers
74 views

text analysis: split document in seperated lines

For a text analysis I want to split a large document in seperated lines. Then I want to calculated for example the average number of words. A example of the document is the following: ...
2
votes
2answers
49 views

Retain or delete parts of textstring in tweets

For a twitter analysis I collected many tweets. For example: ...
5
votes
2answers
136 views

Find file names in directory

I am trying to find the list of any file in any directory of a given name (by in the directory, I mean directly in the directory, so in a directory which is in the directory would not count). For the ...
3
votes
1answer
73 views

Convert an expression's symbols of form a$x to a[x]

I want a function that takes expressions of the following form: a$x and converts them to a[x]. In particular, consider the ...
2
votes
1answer
57 views

StringExpression: pattern reapeted one or more times matches pattern repeated zero times

I try to construct patterns using Riffle and Except StringExpression@Riffle[{"a", "b", "c"}, Except[{"=", ","}] ..] and expect it to match "a_b_c", but not ...
3
votes
3answers
166 views

StringCases using RegularExpression fails when there is missing data

I got some text scraps with this structure "Focal Plane: 198' Active Aid to Navigation: Yes *Latitude: 35.250 N *Longitude: -75.529 W" But some of them lack ...
9
votes
1answer
254 views

Wikipedia People only search

I am trying to search people from Wikipedia(For example .*John.* in REGEX). The following query is close, but it isn't generalized like ...
2
votes
2answers
148 views

How to convert long integers in the expression into the products of their prime factors via Mathematica?

I have many of the following expressions created by CForm of Mathematica: ...
3
votes
2answers
121 views

Mathematica regex equvalent of \l

In normal RegEx \l will make the character to the right lowercase. However, it seems like the RegEx in Mathematica does not have this functionality. For example ...
2
votes
1answer
86 views

Make MyLogicalExpand

The function by Mathematica to expand a formulation with ANDS, ORS, NOT, XOR, and others, is LogicalExpand, let see an example: ...
3
votes
1answer
206 views

Extract date from a not well-formed string

Is there a way to robustly extract date and time from a text? Say for example: ...The event will be held on 17/10/2013 at 3:30 PM in the room 121 and everyone is welcome... should return: ...
31
votes
1answer
523 views

Why is StringExpression faster than RegularExpression?

Edit: as noted by Albert Retey the performance difference is only seen when sub expression extraction is performed. If this test is used below the timings are similar: ...
4
votes
5answers
269 views

A simple StringCases problem

Given this text: text1 = " A Vitamin D Deficiency (ICD-9-CM 268.9) (ICD-9-CM 268.9) 09/11/2015 01 "; Yes, the ICD code values are duplicates- possibly but ...
10
votes
1answer
644 views

Mathematica equivalent of regex '\w{2,3}'

It beats me to write the Mathematica pattern equivalent to the regex: \w{2,3} Any ideas?
7
votes
1answer
2k views

What pattern will match accented letters in a regular expression?

How should I modify the following such that the accented letter É is matched and the expression returns True? ...
4
votes
4answers
634 views

Creating lists from a string, separating words from numbers

Say I have a string that contains numbers and words, such as this one: string = "there are 1234 words and numbers 5678 in here $999"; How would I separate the ...
11
votes
2answers
353 views

Should I use \\\“ or \” to match " in regex?

Both of the following return True: ...
5
votes
2answers
307 views

Tabs inside expression to format code

In a similar spirit to a question proffered several days back,and as that question stated, Since the front-end is quite extendable my question is... Does the front end provide any way to use ...
15
votes
4answers
871 views

Finding all dictionary words that can be made with a given set of characters (Wordfeud/Scrabble)

This is a slightly more involved variant of this recent question. By sheer coincidence I happened to have been building a Wordfeud (Scrabble clone) game in Mathematica. My interactive Wordfeud ...