Texmaker and TeXstudioTeXmaker. Regular expression. Question.

Information and discussion about Texmaker, an integrated LaTeX environment for several platforms, and the related TeXstudio
Post Reply
german_raf
Posts: 3
Joined: Sun Dec 15, 2019 1:24 pm

TeXmaker. Regular expression. Question.

Post by german_raf »

Hello!
I am new to TeXmaker and I have a question.
I try to substitute the '\' character in front of '%' in '1%' (example). To do this, I type the search string -- (\d+)(%) and then the replacement string -- '\1\\\2' or '\$1\$2'. And I can’t make this sign. The program perceives all service and printed characters as printed. Instead '1\%' I get '\1\\\2' or '\$1\$2'.
How to set the replacement command in the replace string correctly?
But TeXStudio do all ok.

Sorry for my english.

Thanks,
German.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

german_raf
Posts: 3
Joined: Sun Dec 15, 2019 1:24 pm

TeXmaker. Regular expression. Question.

Post by german_raf »

I found it. Solution.
Find: (\d+)%
Replace: $1\%

Very strange. Killed the TeXmaker.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

TeXmaker. Regular expression. Question.

Post by Stefan Kottwitz »

Hi German,

welcome to the forum!

Thank you for letting us know the solution. I am German too but I don't use Texmaker. But I use regular expressions often. Nowadays LaTeX supports it.

Stefan
LaTeX.org admin
german_raf
Posts: 3
Joined: Sun Dec 15, 2019 1:24 pm

TeXmaker. Regular expression. Question.

Post by german_raf »

Hi, Stefan

Very thanks. I found TexStudio and in it's ok with regex.

German
mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

TeXmaker. Regular expression. Question.

Post by mas »

Stefan Kottwitz wrote: But I use regular expressions often. Nowadays LaTeX supports it.
Hi Stefan,

Can you elaborate what you mean by that? I am under the impression that regex is a function provided by editors/programs/etc. I do not understand "LaTeX supports it".

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

TeXmaker. Regular expression. Question.

Post by Stefan Kottwitz »

There's the l3regex package.

From the package description:
The package provides regular expression testing, extraction of submatches, splitting, and replacement, all acting on token lists. The syntax of regular expressions is mostly a subset of the PCRE syntax (and is very close to Posix), with some additions arising from the fact that TeX manipulates tokens rather than characters.
Also I use regular expressions a lot on the shell, with perl, and with sed (the stream editor) and other editors (such as Textmate on my Mac). So I like the fact that regular expressions can be used right within LaTeX, since I use LaTeX also for text processing, but more creating (huge configuration files for network devices) and less parsing - but parsing log files with regexps and generating reports would be another good use case.

Stefan
LaTeX.org admin
mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

TeXmaker. Regular expression. Question.

Post by mas »

Thanks :-)

I tried texdoc l3regex and it came up empty. No documentation seems to be bundled with TeXLive. CTAN page also was not helpful (for me). Where can I find info about how to use this package?

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

TeXmaker. Regular expression. Question.

Post by Ijon Tichy »

From the l3regex catalogue entry:
The package is currently distributed as part of the LaTeX3 l3kernel bundle.
Like all parts of the LaTeX3 l3kernel bundle it is documented in the LaTeX3 interface guide interface3.pdf (currently part XXVII). But before you try to use a LaTeX3 kernel package, you should also read the LaTeX3 programming language guide expl3.pdf. The LaTeX3 style guide l3styleguide.pdf could also be useful, if you want to distribute the your programming result. Clicking to the link in the quoted sentence above should have lead you to all the linked guides too.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply