Tagged with RegEx - Visokio Forums http://forums.visokio.com/discussions/tagged/RegEx/feed.rss Mon, 30 Oct 17 12:13:12 -0400 Tagged with RegEx - Visokio Forums en-CA SearchRegex Formula not working http://forums.visokio.com/discussion/3267/searchregex-formula-not-working Mon, 18 Sep 2017 06:30:00 -0400 JohnMR 3267@/discussions
I'm trying to use Searchregex formula to pull

=searchregex("^.{3}[A-Za-z0-9 ]+\K.",[Campaing],1)

Searchregex usually works but not when I add the "\" in \K I get an error: Error with formula: Invalid text """ - an open bracket, literal number, reference or function was expected.

When I remove the slash the formula works but I need that slash in it. Why is this not working?
Thanks,
John.]]>
Bar/Line View: Split by/Stack/Tile w/Tags & RegEx? http://forums.visokio.com/discussion/2883/barline-view-split-bystacktile-wtags-regexs Wed, 25 Mar 2015 09:21:39 -0400 rng 2883@/discussions This works fine, but then it appears to disable 'Active' filtering?

Clicking on any of the "new" categories (stack bars) does not create brushing effects in other views like it would happen in the case of default stacking of data bars.]]>
Text Processing: Google Analytics string aggregation/counts? http://forums.visokio.com/discussion/2600/text-processing-google-analytics-string-aggregationcountss Mon, 16 Jun 2014 11:38:21 -0400 Ben_Owens 2600@/discussions
We currently have some features that pass some details in the URL (below is a very simplified example to illustrate my case)

www.mywebsite.com/fundfactsheets?ISIN=ANUMBER

So I'm getting in my data set

www.mywebsite.com/fundfactsheets?ISIN=0000001; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000002; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000003; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000004; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000005; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000006; page count 2
www.mywebsite.com/fundfactsheets?ISIN=0000007; page count 2

I really want this as aggregated data

www.mywebsite.com/fundfactsheets?ISIN* ; page count 14

I've not been able to find any regrex or way to manipulate the data within Visokio (new tool - it could be staring me in the face!!) to achieve this.

I've had a look on the forum but not seen anything there either.

Any ideas? I'm sure it will do this so any help will be gratefully received.

]]>
Text Mining: Wildcard operation + list of functions http://forums.visokio.com/discussion/2545/text-mining-wildcard-operation-list-of-functions Fri, 02 May 2014 07:34:24 -0400 tobasko 2545@/discussions
I was testing the Text Mine Operation and think that the extraction of custom entities is a very nice feature. However, is it possible to extract regular expression (RegEx) or 'wildcard' patterns, like for example: "Host * has failed"? This would extract all matching phrases/tuples like "Host A has failed", "Host B has failed", and so on?

I haven't been able to get this to work yet unfortunately. If it is not possible, is there any other way to achieve something like this?

Many thanks in advance.

Cheers,
Tobi]]>
Idea: Text Processing - Eliminate/substitute unwanted characters within strings? http://forums.visokio.com/discussion/2389/idea-text-processing-eliminatesubstitute-unwanted-characters-within-stringss Tue, 29 Oct 2013 07:06:58 -0400 davedunckley 2389@/discussions
Just wondering if there is a way of replacing everything within brackets in a string of text.

I have a field that has a name, then a former name within parentheses. I would like to be able to remove the ( ) and also everything within.

Example:

Smith (jones)

Should become:
Smith

as should:
(jones) Smith

Thanks in advance
Dave]]>
New: "Search/replace" now supports RegEx and Wildcards (2.9+) http://forums.visokio.com/discussion/2457/new-searchreplace-now-supports-regex-and-wildcards-2.9- Mon, 27 Jan 2014 08:02:11 -0500 victor 2457@/discussions
image

You can now use wildcards (* and ? ) in the "Search for" field for a simple, yet powerful, search/replace...or you can use full-fledged Regular Expressions (RegEx) which can read and even re-write almost any text string to bring out visual and filtering patterns implicit in raw unstructured data.

The regular expression syntax and replacement patterns are the same as the ones used in the formula function REPLACEREGEX. For a complete reference of the RegEx syntax, visit http://www.regular-expressions.info/]]>
Validation: Formulae to validate incoming value format in a field? http://forums.visokio.com/discussion/2126/validation-formulae-to-validate-incoming-value-format-in-a-fields Tue, 07 May 2013 07:11:51 -0400 Barcl 2126@/discussions byte 1 should be alphabetic
bytes 2-5 should be numeric
byte 6 should be alphabetic
bytes 7-10 should be numeric

In order to verify that format I created a new field with the following formula:

IF ([Codice Monitoraggio]=null,null,
LEN([Codice Monitoraggio])!=10,"lunghezza errata",
(LEFT([Codice Monitoraggio],1))<"A","Formato errato",<br /> (LEFT([Codice Monitoraggio],1))>"Z","Formato errato",
(MID([Codice Monitoraggio], 2, 4))<"0000","Formato errato",<br /> (MID([Codice Monitoraggio], 2, 4))>"9999","Formato errato",
(MID([Codice Monitoraggio], 6,1))<"A","Formato errato",<br /> (MID([Codice Monitoraggio], 6,1))>"Z","Formato errato",
(MID([Codice Monitoraggio], 7, 4))<"0000","Formato errato",<br /> (MID([Codice Monitoraggio], 7, 4))>"9999","Formato errato",
null
)

I was wandering if I can find a better way to verify those values.

Do you believe it is possible to use a JavaScript based on Regular Expressions (RegEx) with the match function? I'm not a Javascript expert... I was trying to find a PHP ereg equivalent in Java?

Thanks.]]>
Formulae: Regex - Extracting Subset of String? http://forums.visokio.com/discussion/1822/formulae-regex-extracting-subset-of-strings Tue, 09 Oct 2012 19:01:15 -0400 shaji_o 1822@/discussions Extracting text using Javascript http://forums.visokio.com/discussion/1364/extracting-text-using-javascript Wed, 07 Mar 2012 06:12:18 -0500 Guy_Cuthbert 1364@/discussions here, and I thought further examples might be useful... so here is a tutorial on how to extract selected text from a field using regular expressions...

Firstly, the use case to answer the question "Why would I want to do this?":

Omniscope users familiar with the formula language may well have come across the SEARCH and SEARCHREGEX functions, which return the position at which a particular character/phrase (in the case of SEARCH) or regular expression pattern (in the case of SEARCHREGEX). These functions are often used to extract elements of text - for example, extracting parts of a postcode; the UK postcode comprises 4 sections:

Structure of a Postcode

So, from a full postcode, we might want to extract the postcode area (first 1-2 characters) or the postcode district (all characters before the space). Finding the space, and extracting everything left of the space, is fairly easy using the SEARCH function, so I will focus on the trickier example of extracting the postcode area.

Using SEARCHREGEX, I can do this in Omniscope by detecting the first alpha character (i.e. A-Z) and the first numeric character (i.e. 0-9) and then extract the characters between these two extremes. To do this we would use:

DECLARE(
/* Store position of first alpha (A-Z) and first nuymeric (0-9) */
firstAZ, SEARCHREGEX("[A-Z]",[Postcode]),
first09, SEARCHREGEX("[0-9]",[Postcode]),
IF(
/* Check that we found both an alpha and a numeric, and that the numeric is after the alpha i.e. a valid postcode format */
AND(firstAZ > 0,first09 > firstAZ),
/* Extract the alpha characters, if valid */
MID([ Postcode], firstAZ, first09-firstAZ),
/* Return nothing if postcode invalid */
NULL
)
)


However, regex extraction is simpler and (once we're confident in regex - lots of tutorials online) allows for far more complex extractions. So here is the same function using Javascript:

SCRIPT(`
// Declare the pattern we want to extract, and then apply it to our input text
var re = /([A-Z]*)/;
var m = re.exec(text1);
// We should have one (or more) groups of character sets now
if (m == null) {
// If not, then return "No"
'No'
} else {
// If we do have at least one character group, return the first (could return many, concatenated, if required)
m[0]
}
`, "text1", [Postcode])


The structure of this is:
  1. Firstly we have the Javascript code itself, which includes the use of a variable called "text1"
  2. Then, in the last line, we have the declaration of "text1" (this can be called anything, and needs to be the same name here as inside the script itself, and passing the value of our [Postcode] field into this variable, for use in the script

This only scrapes the surface of this (Javascript regex) approach - there are many ways to use this as the basis for far more complex, and valuable, text extractions... but as Steve's original article demonstrates, there are many, many more uses for Javascript.

Happy scripting... ]]>