Where do I find realURLs replace patterns? - typo3

Where do I find realURLs replace patterns?
For example realurl replaces a space " " with a line "-". Or "ä" to "ae". And so on. I need the hole "replace-list"

You will find it in typo3conf/ext/realurl/class.tx_realurl_advanced.php

Related

Replace words but only after a colon

I have been researching this for quite some time but cannot seem to find an answer. Perhaps someone here can help.
I am trying to use sed to replace words in yml / yaml files. Since some of the words are included in the names I want to only replace words that appear after the colon (':').
For example. If the .yml file includes:
en:
label_some_tracker: A tracker
label_all_tracker: All trackers
label_attachment_type_trackers: Select trackers.
tracker_plural: trackers
and I want to replace all occurrences of tracker with issue in all values. The pattern:
s/tracker/issue/
also changes the names of the fields, which breaks my code.
I can reduce the size of the problem somewhat by including terms for all possible variants of a word. For example:
s/trackers/issues/
s/tracker/issue/
but that doesn't deal with all situations.
I have tried inserting a space before the search term:
s/ tracker/ issue/
but that matches names where the search term is at the beginning of the line.
If I search for whole words then it still seems to pick up the names because ':' and '_' are 'non word' characters.
If I try to put spaces at the beginning and end of the search term but then it misses words that are at the end of a line or words patterns with punctuation marks before the training space.
The only sure way seems to be to only replace words after a colon (':') but I cannot seem to figure out how to do that with sed.
Does anyone here know how?
With GNU sed:
sed -E 's/(:.*)tracker/\1issue/g' file
Output:
en:
label_some_tracker: A issue
label_all_tracker: All issues
label_attachment_type_trackers: Select issues.
tracker_plural: issues
Replace second occurance:
sed 's/tracker/issue/2' file

Find the good regex in eclipse

I would like to know if it's possible to filter code line from a search with eclipse.
Example: I have to extract all part of code between "" excluding all line starting with 'logger' and also all comment starting with //. I didn't find the exact RegEx to do that...
Can you help me please? Thanks in advance. Best regards.
You can use ^((?:[^\r\n"](?!logger)(?!//))++)("[^"]*+") for that:
the first group (\1) will contain the characters before the first "..." in a line,
the second group (\2) matches "...".
The restriction of this regular expression is that only the first "..." in a line will be matched.

Emacs: Convert string with multiple manipulations

I know, ridiculous title. Here's what I need to do:
Take strings that look like this:
* [1.1 Training]()
* [1.1.1 Special Training by Category]()
* [A. New Hire Orientation Program]()
And add .md suffix to each and place results in the parens, like this:
* [1.1 Training](training.md)
* [1.1.1 Special Training by Category](special_training_by_category.md)
* [A. New Hire Orientation Program](new_hire_orientation_program.md)
I'm using Emacs and need a macro that will:
Search each string (line)
Copy everything after the chapter number, chapter letter, or period, and before the closing " ] "
Transform it to lower case, remove spaces and replace them with underscores
Add " .md " to the results
Paste results between the parens
I'm trying to learn regex and string manipulation, but this one seems pretty involved. Any help is appreciated.
Thanks
Depending on how often you need to do this, you might want to write a command for it. But it can be done with query-replace-regexp (C-M-%) with regexp \[\([[:alnum:].]+\) \([[:alnum:] ]+\)\]() and replacement [\1 \2](\,(replace-regexp-in-string " " "_" (downcase \2)).md). Notice the \,: it allows you to use elisp to transform strings.
Links:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Backslash.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.html

complete list of special characters (e.g \nquit)

I desperatly tried to find out what symbol '\nquit' is... and I couldnt find any reference in the web.
What I tried to find is a complete list of all of those characters (\n, \p, \0, ...) but I couldn't find any.
cheers usche
Wikipedia has a list of C language escapes here.
As noted in my comment, I believe this represents the newline (linefeed) character \n followed by the word quit (which would be forced by the newline to the beginning of the next line of output). But in that case the string should be "double"-quoted rather than 'single'-quoted.

Why does Github Flavored Markup only add newlines for lines that start with [\w\<]?

In our site (which is aimed at highly non-technical people), we let them use Markdown when sending emails. That way, they get nice things like bold, italic, etc. Being non-technical, however, they would never get past the “add two lines to make newlines actually work” quirk.
For that reason mainly, we are using a variant of Github Flavored Markdown.
We mainly borrowed this part:
# in very clear cases, let newlines become <br /> tags
text.gsub!(/^[\w\<][^\n]*\n+/) do |x|
x =~ /\n{2}/ ? x : (x.strip!; x << " \n")
end
This works well, but in some cases it doesn’t add the new-lines, and I guess the key to that is the “in very clear cases” part of that comment.
If I interpret it correctly, this is only adding newlines for lines that start with either a word character or a ‘<’.
Does anyone know why that is? Particularly, why ‘<’?
What would be the harm in just adding the two spaces to essentially anything (lines starting with spaces, hyphens, anything)?
'<' character is used at the beginning of a line to quote messages. I guess that is the reason.
The other answer to this question is quite wrong. This has nothing to do with quoting, and the character for markdown quoting is >.
^[\w\<][^\n]*\n+
Let's break the above regex into parts:
^ = anchor start of string.
[\w\<] matches a word character or the start of word boundary. \< is not a literal, but rather a GNU word boundary. See here (do a ctrl+f for \<).
[^\n]* matches any length of non-newline characters
\n matches a new line.
+ is, I believe, a possessive quantifier.
I believe, but am not 100% sure, that this simply is used to set x to a line of text. Then, the heavy work is done with the next line:
x =~ /\n{2}/ ? x : (x.strip!; x << " \n")
This says "if x satisfies the regex \n{2} (that is, has two line breaks), leave x as is. Otherwise, strip x and append a newline character.