Google Data Studio - Extract text after character ? using regex - google-data-studio

I am trying to create a calculated field in Data Studio using regex formula. I would like to extract text after a character ? in the page url. Below is the data input and the expected output
Input
Output
example.com/solutions?search=reg
search=reg
example.com/solutions?sort_field_name=visits_count&sort_direction=desc&category=Advanced+Patient+Scheduling
sort_field_name=visits_count&sort_direction=desc&category=Advanced+Patient+Scheduling
example.com/categories/c2a3dd33-4b3d-4a01-955f-faee81abc871?tab=resources
tab=resources
example.com/solutions
null
I tried following and can't seem to get it to work in Data Studio. But this works here: https://regex101.com/r/k5CRjN/1
REGEXP_EXTRACT(Full page URL,'[^?]+$')
I also tried escaping special character but still doesn't work

can you try:
REGEXP_EXTRACT([FIELD NAME],'\\?(.*)$')

Related

Insert unicode characters in React

I want to use this arrow in my React app: U+02197.
I read this article that explains why how to force a unicode symbol to render as text insted of emoji.
Infat I want that the symbol is alway rendered as text.
I try:
U+02197
But it is rendered as string "U+02197". How can I visualize the char?
I try also:
U+2197 &U+2197; U+02197 U+02197; &U+02197; \U+02197 \u02197
Using ↗↗ ↗ the result in Chrome on Macbook is:
and on Chrome/Firefox on Android mobile the result is different:
I want always the char as text so always like that .
You need a specific format for this to work on React, you can do the following:
{'\u02197'}
You have to use the curly braces to prevent React from formating the string to just HTML content.
Try String.fromCharCode() where the argument is the decimal representation of the unicode character (which is hex).
U+02197 would be written as String.fromCharCode(8599)
In my case, I needed an up (U+25B2) and down (U+25BC) arrow, so I got it working doing something like this:
<span className="direction">
{String.fromCharCode(this.state.direction === "up" ? 9650 : 9660)}
</span>
Try using the hex code:
↗︎
Source: https://www.fileformat.info/info/unicode/char/2197/index.htm

Open Tag - Close Tag " { } " - How can to formating

Hello on excel i have big data.Is only one column the data and i want split by tags "{" and "}". On column the image is like that:
{{[math1];1;1;5.6617};{[math2];1;1;34.3131};{[math3];1;1;4.5293}}
If i format the text is like that:
{
{[math1];1;1;5.6617}; //Math1
{[math2];1;1;34.3131}; //Math2
{[math3];1;1;4.5293} //Math3
}
i want split //Math1 , //Math2 & //Math3
The data is from SQL server maybe help this. I can use any tool extra on excel for data model?
Following should be helpful though not sure its the best way to solve your problem.
For first part i.e. Math1, use the following formula
=MID(A1,2,SEARCH("};",A1,1)-1)
For second part i.e. Math2, use the following formula
=MID(A1,SEARCH("};",A1,1)+2,SEARCH("};",A1,SEARCH("};",A1,1)+1)-SEARCH("};",A1,1)-1)
For third part i.e. Math3, use
=MID(A1,SEARCH("};",A1,SEARCH("};",A1,1)+1)+2,LEN(A1)-SEARCH("};",A1,SEARCH("};",A1,1)+1)-2)
See image for reference

Issues with searching special characters in Solr

I'm using Solr 6.1.0
When I use defType=edismax, and using debug mode by setting debug=True, I found that the search for "r&d" is actually done to search on just the character "r".
http://localhost:8983/solr/collection1/highlight?q="r&d"&debugQuery=true&defType=edismax
"debug":{
"rawquerystring":"\"r",
"querystring":"\"r",
"parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
"parsedquery_toString":"+(text:r)"
Even if I search with escape character, it is of no help.
http://localhost:8983/solr/collection1/highlight?q="r\&d"&debugQuery=true&defType=edismax
"debug":{
"rawquerystring":"\"r\\",
"querystring":"\"r\\",
"parsedquery":"(+DisjunctionMaxQuery((text:r)))/no_coord",
"parsedquery_toString":"+(text:r)",
But if I'm using other symbols like "r*d", then the search is ok.
http://localhost:8983/solr/collection1/highlight?q="r*d"&debugQuery=true&defType=edismax
"debug":{
"rawquerystring":"\"r*d\"",
"querystring":"\"r*d\"",
"parsedquery":"(+DisjunctionMaxQuery((text:\"r d\")))/no_coord",
"parsedquery_toString":"+(text:\"r d\")",
What could be the reason behind this?
Regards,
Edwin
First - if you're using the URL as you've pasted, & is the separator between different arguments in the URL, and have to be properly urlencoded if it belongs to an argument, and is not an argument separator.
q=text:"foo&bar"&fl=..
is parsed as
q=text:"foo
bar"
fl=..
Your Solr library usually handles this for you transparently. text%3A%22r%26d%22 is the urlencoded version of text:"r&d".
Secondly, any further parsing will depend on the analysis chain and tokenizer for the field you're searching. This determines which characters are kept and how the text is tokenized (split into separate tokens) before the tokens are matched between the querying text and the indexed text.
What Analyzer are you using for your field . Better try a Analyzer that doesn't tokenize your field much like KeyWordTokenizerFactory.

Unicode/special characters in help_text for Django form?

I am trying to add a special character (specifically the ndash) to a Model field's help_text. I'm using it in the Form output so I tried what seemed intuitive for the HTML:
help_text='2 – 30 characters'
Then I tried:
help_text='2 \2013 30 characters'
Still no luck. Thoughts?
django escapes all html by default. try wrapping your string in mark_safe
You almost had it on your second try. First you need to declare the string as Unicode by prefacing it with a u. Second, you wrote the codepoint wrong. It needs a preface as well; like \u.
help_text=u'2\u201330 characters'
Now it will work and has the added benefit of not polluting the string with HTML character entities. Remember that field value could be used elsewhere, not just in the Form display output. This tip is universal for using Unicode characters in Python.
Further reading:
Unicode literals in Python, which mentions other codepoint prefaces (\x and \U)
PEP263 has simple instructions for using actual raw Unicode characters in a source file.

Custom Format String that doesn't show trailing "." when the number is whole

We're currently using a custom format string: "#,###.##"
In our DevExpress control in the following way:
"Settings:TextEditSettings MaskType="Numeric" DisplayFormat="#,###.00;;#" Mask="#,###.##"/"
Imagine the input to this is the double "20.000".
We'd like this to be "20.00" in display mode, and "20" in edit mode (i.e. what the Mask is trying to specify). We find that this almost works, but there we get "20." in edit mode. Can anyone advise on a format string that does not have the trailing "." when the number is whole?
Thanks.
For display mode use "0#.0#" and in Edit mode use "0#"
[Edit]: Since your showing commas for display, use "0#,###.0#"

Resources