remove all special characters in zapier - zapier

I have several variables coming in to zapier that i'd like to remove all special characters (only English letters and numbers remaining). How do I do that in JavaScript and what do I enter in the "Code" box of my zap? I am not a coder, as you can tell.

If you are not a coder, using the Zapier Formatter may be an easier option.
You can choose the Replace feature, state the input you would like to work on, and then choose what text to replace with another text.
For example, you can choose a special character that Zapier supports like [:newline:] which is a line break, and then place in nothing for the "Replace" option. This would remove all line breaks from the input.
Hope this helps!

Related

Trying to use Regex match an iOS phone number using iOS Shortcuts

I'm creating an iOS shortcut that starts with checking whether the clipboard currently holds a copied phone number.
So far, my regex is the following:
^[\d\()-‑+  ]+$
Although while typing a regular phone number using the phone keyboard, e.g., +972 12-345-6789, it works just fine; it seems like when copied directly from the default Phone application, it does not find it as a match.
I should mention that after digging for a while, it seems like the phone number copied from the Phone application is associated with some extra special characters used for Left-To-Right Embedding and such. Using a Unicode decoder gave me the following string:
‪+972 12‑345‑6789‬
I'm not even sure whether this is the reason, but it might have some connection to it. If so - is there any way in which I can use iOS Shortcuts to decode the clipboard text into a Unicode format and remove those extra characters? And in case there is no connection between the two, what else might be the problem?
You can add the support for all these chars to the pattern:
^[\d()+\p{Zs}\p{Pd}\p{Cf}]+$`
Note:
\p{Zs} matches all whitespaces without the tabs and line breaks (add \t to the brackets if you need to support TAB)
\p{Pd} will match any dashes
\p{Cf} matches the bidirectional marks and more other control format chars.
Alternative solution
It is possible to paste the copied clipboard text into a Text action which removes any additional formatting.

how to add subscript(or superscript) in notion block?

i am new in using notion as a notebook.Before this,i use oneNote instead,because i found that notion is more convinient in same ways.But one thing making me annoyed is that i can't add subscript(or superscript) in notion text block。Are there any fellows can handle this?
as shown:
text with subscript i need
when i edit in notion block i get like this
For subscript:
/math
Then C_1 renders C1
For superscript:
/math
Then C^2 renders C2
In the latest version as of writing, you could use:
$$c^2$$ - for superscript
$$c_2$$ - for subscript
If you write any mathematical equation between $$ $$, it will render beautifully on notion.
For more than 1 character superscript
/math
P^{xyz}
Result: Pxyz
For more than 1 character subscript
/math
P_{xyz}
Result: Pxyz
In fact, this works for 1 or many characters as subscript or superscript.
Even I just started using notion and faced the same problem. The solution I found was to keep a tab of laTex containing the syntax for all the required math formulae open. It is only temporary as you will get used to them pretty quickly.
You can use tex to write things is superscript or subscript or basically any type of formulae , but its still in tex.
I did and worked on my Notion
Step 1: Choose what to add subscript(or superscript) in notion block (Example a^n)
Step 2: Choose symbol sqrt(x)
Step 3: Press "Done"
In Notion, there are two ways to add math formulas: inline equations and block equations. Both use KaTeX formatting to show the formulas. KaTeX is a TeX display formulas method based on JavaScrpt language. When you place a block or inline equation, for your example, you have to do something like that in the code:
w_{1}=0 ~,~ w_{2}=1
Note that spaces are not rendered, you gotta use ~ separate things, and the { } on these subscripts are optional because when not placed, the "" will take just the first next character. To do superscript, change the "" to "^". You can combine both in the same main variable, like w_2^2=1.
In the following links, you can see a Notion's guide about how to use it, the supported features KaTeX allows you to do, and a link to easy creating formulas.
Notion:
https://www.notion.so/help/math-equations
KaTeX Supported Functions:
https://katex.org/docs/supported.html or
https://katex.org/docs/support_table.html
Easy web TeX editor:
https://atomurl.net/math/
Take time to try and explore writing by typping. Then, when you get used to it, it flows easily like writing regular text.
For anyone stumbling upon this question who does not want to write math equations but simply wants to add a couple of superscript or exponent elements to a Notion page, for instance to write footnotes: there seems to be no way to add "simple" superscript (inline and with the same font), but you can use superscript unicode characters, for instance with a tool such as this one.
It is not perfect as many characters are not available, but will cover many¹ common² uses³ of superscriptᶜᶦᵗᵃᵗᶦᵒⁿ ⁿᵉᵉᵈᵉᵈ.

Eggplant : How to read text with special characters like ' _ etc

I am trying to read a text in a given rectangle using readText() function.
The function works correctly except when it has to read some text which has special characters like ' _ & etc.
I tried using validCharacters with readText() function. But it didn't help.
Code -
put ReadText((287,125,810,164),validCharacters:"_-'.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890") into Login
I tried working with character collections. But that doesn't seem to be right because the text trying to pick is a dynamic text combination of numbers alphabets and a special character. So one cannot create a library of character collection of every alphabet (a-z, A-Z), numbers(0-9) and special characters.
Example of text trying to read:
Login_Userid1_1, Login'Userid1_1
So how do I read such text correctly
Debugging OCR is a bit of an imprecise science. EggPlant has a lot of OCR Parameters to tweak. When designing test cases it's best to try use other mechanisms to gather information whenever possible. ReadText() should be considered a last resort when more reliable methods are unavailable. When I've used it I've often needed to do a lot of trial and error to find the right set of settings, and SearchRectangle to get consistent results. Without seeing exactly what images you are trying to read text from it's difficult to impossible to troubleshoot where the issue might be.
One thing that does stand out to me is that you're trying to read strings that may contain underscores. ReadText() has an optional property IgnoreUnderscores which treats underscores as spaces. By default this property is set to ON. It defaults to ON because some OCR engines have problems identifying underscore characters consistently.
If you want to have ReadText() handle underscores you'll want to explicitly set this property to OFF.
ReadText(rect, validCharacters:chars, ignoreUnderscores:OFF)

Sanitize pasted text from MS-Word

Here's my wild and whacky psuedo-code. Anyone know how to make this real?
Background:
This dynamic content comes from a ckeditor. And a lot of folks paste Microsoft Word content in it. No worries, if I just call the attribute untouched it loads pretty. But the catch is that I want it to be just 125 characters abbreviated. When I add truncation to it, then all of the Microsoft Word scripts start popping up. Then I added simple_format, and sanitize, and truncate, and even made my controller start spotting out specific variables that MS would make and gsub them out. But there's too many of them, and it seems like an awfully messy way to accomplish this. Thus so! Realizing that by itself, its clean. I thought, why not just slice it. However, the microsoft word text becomes blank but still holds its numbered position in the string. So I came up with this (probably awful) solution below.
It's in three steps.
When the text parses, it doesn't display any of the MSWord junk. But that text still holds a number position in a slice statement. So I want to use a regexp to find the first actual character.
Take that character and find out what its numbered position is in the total string.
Use a slice statement to cut it from.
def about_us_truncated
x = self.about_us.find.first(regExp representing first actual character)
x.charCount = y
self.about_us[y..125]
end
The only other idea i got, is a regex statement that allows it to explicitly slice only actual characters like so :
about_us([a-zA-Z][0..125]) , but that is definately not how it is written.
Here is some sample text of MS Word junk :
≪! [If Gte Mso 9]>≪Xml>≪Br /> ≪O:Office Document Settings>≪Br /> ≪O:Allow Png/>≪Br /> ≪/O:Off...
You haven't provided much information to go off of, but don't be too leery of trying to build this regex on your own before you seek help...
Take your sample text and paste it in Rubular in the test string area and start building your regex. It has a great quick reference at the bottom.
Stumbled across this
http://gist.github.com/139987
it looks like it requires the sanitize gem.
This is technically not a straight answer, but it seems like the best possible one you can find.
In order to prevent MS Word, you should be using CK Editor's built-in MS word sanitizer. This is because writing regex for it can be very complicated and you can very easily break tags in half and destroy your site with it.
What I did as a workaround, is I did a force paste as plain text in the CK Editor.

Replace strings in LaTeX

I want LaTeX to automatically replace strings like " a ", " s ", " z " with " a~", " s~", " z~", because they can't be at line end. Any suggestions?
For Czech typographic rules, there is a preprocessor called Vlna" by Petr Olšák - download . The set of (usually prepositions in czech) is customizable - so it might be usable for other languages as well.
You can use \StrSubstitute from xstring package.
e.g.
\StrSubstitute{change ME}{ ME}{d}
will convert change ME into changed.
Although, nesting is not possible, so to make another substitution you must use an intermediate variable in this way
\StrSubstitute{change ME}{ ME}{d}[\mystring]
\StrSubstitute{\mystring}{ed}{ing}
Finally, your solution would be
\usepackage{xstring}
\def\mystring{...source string here...}
\begin{document}
\StrSubstitute{\mystring}{ a }{a~{}}[\mystring]
\StrSubstitute{\mystring}{ s }{s~{}}[\mystring]
\StrSubstitute{\mystring}{ z }{z~{}}[\mystring]
\mystring
\end{document}
Note the use of the empty string {} to avoid the sequence ~}.
I'm afraid (to the best of my knowledge) this is basically impossible with LaTeX. A LuaTeX-based solution might be possible, though.
It's not actually clear to me, however, that " a ", for example, shouldn't appear at the end of a
line. Although I might be used to different typographic rules.
(Is there anything wrong with the line break in the last paragraph? :))
As far as I know there is no way to do this in LaTeX itself. I'd go for automating this with some external tools, as my typical setup involves a Makefile handling the LaTeX run by itself. This makes it rather easy to run tools like sed on the sources and do some replacements using regular expressions, and a simple rule would do this for your case.
If you use some LaTeX editor that does everything for you you should check the editors regular expression search and replace functionality.
Yes, this is the age old argument of data processing vs. data composition. We have always done these things in a pre-processor environment responsible for extracting the information from its source environment, SQL or plain-text, and created the contents of a \input(file.tex).
But yes, it is possible (TeX is after all a programming language) but you will have to become a wizard. Get the 4 volume set TeX in Practice by Stephan von Bechtolsheim.
The approach would be to begin an environment (execute a macro) whose ''argument'' was all text down to the end of the environment. Then just munge though the tokens fixing the ones you want.
Still, I don't think any of us are advocating this approach.
If you are using TeXmaker to write your LaTeX file, then you may click on the Edit button on the toolbar, then click on Replace.
A dialogue box will come up, and you can enter your strings one after the other.
You put the strings to be changed in the Find text input and what you want it to be changed to in the Replace text input.
You can also specify where you want the replacement to start from.
Click Find and Replace (or similiar) in the menu of your text editor and do it.

Resources