Output a backslash in groff, also avoiding hyphenation - printing

How groff can output \ symbol in my text, do not reading this symbol as a macro?
And how to prohibit dividing words with a dash (hyphenation)?

You can get a printing version of the backslash with \e according to the manpage.
And there is .nh for »no hyphenation«.

For me, writing \\ as a sort of escape sequence works fine and outputs a singe backslash "\".

Related

printing backslash AND unicode characters in one field

let's say I want to print a backslash and the pound symbol on a label: \£
I cant. I can only print either the backslash or the pound symbol, but the other one will render incorrectly.
This will print correctly the pound symbol, but will print a cent symbol instead of the backslash:
^XA
^CI28
^FO^AT^FH^FD_c2_a3^FS
^XZ
And this will print correctly the backslash, but not the pound symbol:
^XA
^CI13
^FO^AT^FH^FD_c2_a3^FS
^XZ
Do you know a way to combine these two in one single field ?
Thanks
Use the Field Hex feature:
^XA
^FO10,10^A0,40,40^FH_^FDEuro Symbol/_15/^FS
^XZ
As per ZPL script documents, they mentioned "You can mix character sets on a label." using ^CI command.
But there is no example scripts are available to mix character sets, Instead of that the example scripts are just explaining "how to remap the characters".
Also the document has clearly mentioned that If you want to print backslash, you should use ^CI13(^CI13 must be selected to print a backslash (\)). But If we use ^CI13, Latin characters are not printing properly which expects ^CI28.
So I'm not sure if it's possible to print both Latin characters and backslash (\) in same label.

Double \\ in regular expression iOS

Does anyone understand what this (([A-Za-z\\s])+)\\? means?
I wonder why it should be "\\s" and "\\" ?
If I entered "\s", Xcode just doesn't understand and if I entered "\?", it just doesn't match the "?".
I have googled a lot, but I did not find a solution. Anyone knows?
The actual regex is (([A-Za-z\s])+)\?. This matches one or more letters and whitespace characters followed by an question mark. The \ has two different meanings here. In the first instance \s has a fixed meaning and stands for any white space characters. In the second instance the \? means the literal question mark character. The escaping is necessary as the question mark means one or none of the previous otherwise.
You can't type your regex like this in a string literal in C code though. C also does some escaping using the backslash character. For example "\n" is translated to a string containing only a newline character. There are some other escape sequences with special meanings. If the character after the backslash doesn't have a special meaning the backslash is just removed. That means if you want to have a single backspace in your string you have to write two.
So if you wrote your regex string as you wanted you'd get different results as it would be interpreted as (([A-Za-zs])+)? which has a completely different meaning. So when you write a regex in an ObjC (or any other C-based language) string literal you must double all backslash characters.
not sure about ios but same thing happens in java. \ is escape character for java,and c also so when you type \s java reads \ as an escape character.
think of it as if you want to print a \ what will you have to do.
you will have to type \\. now first \ will work as escape character for java and second one will be printed.
I think it should be the same concept for ios too.
so if you want \s you type \s, if you want \ you type \\.
The \s metacharacter is used to find a whitespace character.
Refer this!

How to define a ruby array that contains a backslash("\") character?

I want to define an array in ruby in following manner
A = ["\"]
I am stuck here for hours now. Tried several possible combinations of single and double quotes, forward and backward slashes. Alas !!
I have seen this link as well : here
But couldn't understand how to resolve my problem.
Apart from this what I need to do is -
1. Read a file character by character (which I managed to do !)
2. This file contains a "\" character
3. I want to do something if my array A includes this backslash
A.includes?("\")
Any help appreciated !
There are some characters which are special and need to be escaped.
Like when you define a string
str = " this is test string \
and this contains multiline data \
do you understand the backslash meaning here \
it is being used to denote the continuation of line"
In a string defined in a double quotes "", if you need to have a double quote how would you doo that? "\"", this is why when you put a backslash in a string you are telling interpretor you are going to use some special characters and which are escaped by backslash. So when you read a "\" from a file it will be read as "\" this into a ruby string.
char = "\\"
char.length # => 1
I hope this helps ;)
Your issue is not with Array, your question really involves escape sequences for special characters in strings. As the \ character is special, you need to first prepend it (escape it) with a leading backslash, like so.
"\\"
You should also re-read your link and the section on escape sequences.
You can escape backslash with a backslash in double quotes like:
["\\"].include?("\\")

grep pattern single and double quotes

Is there any difference between enclosing grep patterns in single and double quotes?
grep "abc" file.txt
and
grep 'abc' file.txt
I'm asking since there's no way I could test all possible cases on my own, and I don't want to stumble into a case that I get wrong :)
I see a difference if you have special characters :
Ex :
grep "foo$barbase" file.txt
The shell will try to expand the variable $barbase, this is maybe not what you intended to do.
If instead you type
grep 'foo$barbase' file.txt
$bar is taken literally.
Finally, always prefer single quotes by default, it's stronger.
In double quote, the following characters has special meanings: ‘$’,
‘`’, ‘\’, and, when history expansion is enabled, ‘!’.
The characters ‘$’ and ‘’ retain their special meaning within double
quotes ($ for variables and for executing).
The special parameters ‘*’ and ‘#’ retain their special meaning in
double quotes as inputs when proceeded by $.
‘$’, ‘`’, ‘"’, ‘\’, or newline can be escaped by preceding them with
a backslash.
The backslash retains its special meaning when followed by ‘$’, ‘`’,
‘"’, ‘\’, or newline. Backslashes preceding characters without a
special meaning are left unmodified.
Also it will be helpful to check shell expansions:
https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html#Shell-Expansions
Single quote ignore shell expansions.

replace escape character in flex

I use flex to work on a scanner to replace \" with "; and \\ with \.
so my code is like
%%
\\" \";
\\\ \\;
but when I compile, I get an error message like missing quote.
I think it's the right regular expression, did I get wrong or it's something special with flex?
You should escape both the \ AND " character. In order to match \" you use \\\" not \\". To match \\ you use \\\\ not \\\.
Another thing is that flex matches a regexp and then execute the C code you placed in the associated action. Your example doesn't look like correct flex statements.
to match *,[,],(,)," ,\,{,}in flex, you have to use escape character(not needed for single quote character).

Resources