I tried below in POSTMAN
console.log('Hello World');
console.log("Hello World");
Showing output in console as below in both the cases
"Hello World"
How to remove those quotation marks and print plain text in POSTMAN console like
Hello World
the syntax is :
console.log(val)
Different ways to represent string is to enclose the string with anyof :
double quotes :" , single quotes: ' and string literal: `
if you want to have string with the quotes escape it out or enclose with a different one
console.log("'Hello world'")
console.log("\"Hello world\"")
console.log('"Hello world'")
console.log(`"'Hello world"'`)
There is no built in way... but if you really want to follow these steps.
View > Developer > Show DevTools (Current Window)
Navigate to the Elements tab in the DevTools
ctrl + f for wf__qt (this will show you the element that holds the quotes
click on this element to see it's styles
in the styles pane, find the wf__qt class and uncheck the content: '"' style
Related
I have search but found python and related solutions.
I have a string like
"Hello 'how' are % you?"
which I want to convert to below after Remove everything except numbers and alphabets
Hello how are you
I am using Regexreplace as follows but now sure what should be the replacement or if its a right approach
=REGEXREPLACE(B2 , "([^A-Za-z0-9]+)")
The main thing i want to remove from the string are the stuff like " or strange symbols
can anyone help?
You can use:
=TRIM(REGEXREPLACE(B2,"[\W_]+"," "))
Or, include the space in your character class:
=REGEXREPLACE(B2,"[\W_ ]+"," "))
Where: \W is short for [^A-Ba-b0-9_], so to include the underscore we added it to the character class.
you can use:
=TRIM(REGEXREPLACE(A1, "'|%|""", ))
I am new to Regex and AppleScript and I need a little bit of support and guidence.
First user inputs a string. It could be anything in one or multilines.
A Regex should be applied on the string in order to find numbers with only 6 digits..no more or less, and separates them by a space.
The final string should look like: 867689, 867617, 866478, 866403, 866343.
Then this string will be converted into a list.
I am using this site to test my Regexes : https://www.freeformatter.com/regex-tester.html
The Regex that matches exactly 6 digits is:
(?<!\d)\d{6}(?!\d)
I am aware that in order to implement Regex to AppleScript i need to use Shell Script. I also am aware that I should use sed but unfortunately I am not fully aware how to use it and what exactly is.
Fallowing a few guides and tests I understood that sed does not work with \d and I should use [0-9] instead and I also should escape the brackets like this \(..\). Also replace $1, should be implemented like \1,. Till this moment I was not able to make it work.
My user input for tests is as follows:
MASTER
ARTIKEL
Artikel
5910020015
867689
PULL1/1
5910020022
867617
PULL1/1
Cappuccino
5910020017
866478
PULL1/1
Braun
5921020017
866403
SHIRT1/2
Kastanie-Multi
5910020016
866343
PULL1/1
and the AppleScript Code itself:
use scripting additions
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
on list2string(theFoldersList, theDelimiter)
set theBackup to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
set theString to theFoldersList as string
set AppleScript's text item delimiters to theBackup
return theString
end list2string
on run {input}
display dialog "Please enter your string: " default answer ""
set stringOfNumbers to the text returned of the result
set num to do shell script "sed 's/\(\(?<![0-9]\)[0-9]{6}\(?![0-9]\)\)\1, /' <<< " & quoted form of stringOfNumbers
--(?<!\d)\d{6}(?!\d)
display dialog stringOfNumbers
set stringOfNumbers to current application's NSString's stringWithString:stringOfNumbers
set listOfArtNumbers to (stringOfNumbers's componentsSeparatedByString:", ") as list
display dialog list2string(listOfArtNumbers, ", ")
return input
end run
Unfortunately everywhere I escape characters by using \ I get an error. So I had to remove all \ but once I run the script I receive "Syntax Error: sed: 1: "s/(?<![0-9])[0-9]{6}(?! ...": unterminated substitute pattern" and all my effort resulted in a similar error.
AppleScript Objective-C allows us to do regular expressions using NSRegularExpression, starting with OS 10.7 (Lion). The following handler returns the results of a regular expressions search as a list:
use AppleScript version "2.4"
use framework "Foundation"
property NSRegularExpression : class "NSRegularExpression"
property NSString : class "NSString"
on findPattern:thePattern inString:theString
set theText to NSString's stringWithString:theString
set theRegEx to NSRegularExpression's regularExpressionWithPattern:thePattern ¬
options:0 |error|:(missing value)
set theResult to (theRegEx's matchesInString:theText ¬
options:0 ¬
range:{location:0, |length|:theText's |length|})'s valueForKey:("range")
set outputArray to {}
repeat with thisRange in theResult
copy (theText's substringWithRange:thisRange) as text to end of outputArray
end repeat
return outputArray
end findPattern:inString:
Note that the '¬' symbol is a line-continuation symbol (type option-return in the AppleScript editor). I've broken up lines to make the script more readable, but that may not copy/paste correctly, so be aware that those should be single, continuous lines.
You use this handler as follows. Remember that the backslash is a special character in AppleScript, so it has to be escaped by preceding it with another backslash:
set foundList to my findPattern:"(?<!\\d)\\d{6}(?!\\d)" inString:"MASTER
ARTIKEL
Artikel
5910020015
867689
PULL1/1
5910020022
867617
PULL1/1
Cappuccino
5910020017
866478
PULL1/1
Braun
5921020017
866403
SHIRT1/2
Kastanie-Multi
5910020016
866343
PULL1/1"
-- Result: {"867689", "867617", "866478", "866403", "866343"}
EDIT
It seems Automator doesn't like the property ClassName : class "ClassName" method I've used, so we have to switch to another form: using current application's ClassName's ... The revised Automator AppleScript looks like so (assuming that the text string is passed in as the input):
use AppleScript version "2.4"
use framework "Foundation"
on run {input, parameters}
set foundList to my findPattern:"(?<!\\d)\\d{6}(?!\\d)" inString:((item 1 of input) as text)
return foundList
end run
on findPattern:thePattern inString:theString
set theText to current application's NSString's stringWithString:theString
set theRegEx to current application's NSRegularExpression's regularExpressionWithPattern:thePattern ¬
options:0 |error|:(missing value)
set theResult to (theRegEx's matchesInString:theText ¬
options:0 ¬
range:{location:0, |length|:theText's |length|})'s valueForKey:("range")
set outputArray to {}
repeat with thisRange in theResult
copy (theText's substringWithRange:thisRange) as text to end of outputArray
end repeat
return outputArray
end findPattern:inString:
I'm fairly new to Ember, but I'm on v1.12 and struggling with the following problem.
I'm making a template helper
The helper takes the bodies of tweets and HTML anchors around the hashtags and usernames.
The paradigm I'm following is:
use Ember.Handlebars.Utils.escapeExpression(value); to escape the input text
do logic
use Ember.Handlebars.SafeString(value);
However, 1. seems to escape apostrophes. Which means that any sentences I pass to it get escaped characters. How can I avoid this whilst making sure that I'm not introducing potential vulnerabilities?
Edit: Example code
export default Ember.Handlebars.makeBoundHelper(function(value){
// Make sure we're safe kids.
value = Ember.Handlebars.Utils.escapeExpression(value);
value = addUrls(value);
return new Ember.Handlebars.SafeString(value);
});
Where addUrlsis a function that uses a RegEx to find and replace hashtags or usernames. For example, if it were given #emberjs foo it would return #emberjs foo.
The result of the above helper function would be displayed in an Ember (HTMLBars) template.
escapeExpression is designed to convert a string into the representation which, when inserted in the DOM, with escape sequences translated by the browser, will result in the original string. So
"1 < 2"
is converted into
"1 < 2"
which when inserted into the DOM is displayed as
1 < 2
If "1 < 2" were inserted directly into the DOM (eg with innerHTML), it would cause quite a bit of trouble, because the browser would interpret < as the beginning of a tag.
So escapeExpression converts ampersands, less than signs, greater than signs, straight single quotes, straight double quotes, and backticks. The conversion of quotes is not necessary for text nodes, but could be for attribute values, since they may enclosed in either single or double quotes while also containing such quotes.
Here's the list used:
var escape = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"`": "`"
};
I don't understand why the escaping of the quotes should be causing you a problem. Presumably you're doing the escapeExpression because you want characters such as < to be displayed properly when output into a template using normal double-stashes {{}}. Precisely the same thing applies to the quotes. They may be escaped, but when the string is displayed, it should display fine.
Perhaps you can provide some more information about input and desired output, and how you are "printing" the strings and in what contexts you are seeing the escaped quote marks when you don't want to.
I'm looking for a way to replace "&" from a text string when it's followed by text. For example;
Input Text: "Ne&w && Edit Record"
Required Output: New & Edit Record"
The reason for "Ne&w" is that "&" then shows w as the shortcut key (underscored in the UI) and the reason for the "&&" is so that a single "&" is displayed in the text.
When using the input text as the value for the text propery on a command button the text displays as expected, but when I pass the text property to a message box it displays the input text in the message box dialog.
I don't want to use the Tag property to store the message I want in the message box as I use the tag property for another value.
Try this:
Dim input As String = "Ne&w && Edit Record"
Dim output As String = "New & Edit Record"
Dim p As String = Regex.Replace(input, "&(?<first>\w|&)", "${first}")
MessageBox.Show(output = p) 'shows True
In the above Regex expression I am capturing an ampersand followed by either a letter or another ampersand, and replacing that sequence with a symbol coming after the ampersand. <first> is a named group, it is used for Regex replacement.
See Regex.Replace on MSDN.
You can remove all & signs not followed by a & sign. Match them like this:
&(?!&)
See it in action
I am tying to replace this:
:b:b:b:b:b:b:b:bvoid Page_Load\(\)\n:b:b:b:b:b:b:b:b\{\n:b:b:b:b:b:b:b:b:b:b:b:b
by this
:b:b:b:b:b:b:b:bvoid Page_Load\(\)\n:b:b:b:b:b:b:b:b\{\n:b:b:b:b:b:b:b:b:b:b:b:bmyclass.dateclass.activite\(Request.ServerVariables\[\"LOGON_USER\"\].Split\('\\\\'\)\[1\], Request.Url.AbsoluteUri\);\n:b:b:b:b:b:b:b:b:b:b:b:b
. I do find the first expression using FIND, but it says that it can't find it when I use REPLACE.
Here is a sample of my code
//Affichage de la page
void Page_Load()
{
myclass.dateclass.activite(Request.ServerVariables["LOGON_USER"].Split('\\')[1], Request.Url.AbsoluteUri);
java.Text = "<script language=\"JavaScript1.2\" type=\"text/javascript\">var sess = \"" + Session["username"] + "\";var user = \"" + Request.ServerVariables["LOGON_USER"].Replace("\\", "\\\\") + "\";</script>";
Session.LCID = 3084; //Utilise des dates en format AAAA-MM-JJ
You don't need to escape round brackets or quotes when using them in the replacement string, nor does it recognise certain character codes, including :b.
Firstly, change your find string to this (the curly braces around the outside are VS's own idiosyncratic way of defining a capture group):
{void Page_Load.+\n[^\{]+\{}
Then, change your replacement string to this (note the \1 to refer to the capture group in the replacement).
\1\nmyclass.dateclass.activite(Request.ServerVariables\["LOGON_USER"\].Split('\\\\')\[1\], Request.Url.AbsoluteUri);\n
The "the following specified text was not found" error that Visual Studio gives you back is actually wrong - it's an issue with the replacement string rather than the string to find.
It's probably worth downloading something like this Regex Search and Replace Addin to save you the headache of having to deal with Visual Studio's bizarre regex syntax.