I updated my MiKTeX today. Now, I do not get any error without packages but it can not compile my latex files with packages.

Uninstalling and reinstalling both Texmaker and Miktex did not work. I could not find l3regex.sty file on internet.

LaTeX Error: File `l3regex.sty' not found.

My packages:

\usepackage[colorlinks=true, linkcolor = blue, urlcolor  = blue, citecolor = blue, anchorcolor = red]{hyperref}  
\usepackage[top=1cm, bottom=2cm, left=1.5cm, right=1.5cm]{geometry}  
\DisableLigatures{encoding = *, family = * }  
  • Update MikTeX in both admin and user mode. See tex.stackexchange.com/q/55437/35864 and tex.stackexchange.com/q/108447/35864
    – moewe
    Mar 15, 2019 at 14:54
  • I think there was a change to how l3regex was distributed a while ago. If I understand correctly it should be part of expl3.sty which should be installed by MikTeX's l3kernel package. So you should make sure that l3kernel is installed an up to date. I assume, though, that the real culprit is an older version of a different package that tries to use the old name to load the module. If the full update in both modes does not help, please try to prepare a so-called MWE (tex.meta.stackexchange.com/q/228/35864) and upload the full .log file to a text-sharing website (e.g. pastebin)
    – moewe
    Mar 15, 2019 at 15:02
  • Aha! tex.stackexchange.com/q/468973/35864 mentions changes in the distribution of l3regex.
    – moewe
    Mar 15, 2019 at 16:38
  • 1
    @AndréC l3regex has been integrated into the kernel. For documents explicitly loading l3regex it should be enough not to load it (make sure that at least expl3 or xparse is loaded). In the code you link, just change \usepackage{xparse,l3regex} to \usepackage{xparse}. But with the preamble shown in this question it is much more likely that not all involved packages were updated correctly (the classic MikTeX update in Admin and User mode issue).
    – moewe
    Oct 6, 2019 at 8:41
  • 1
    @AndréC That would be an answer on the question I've duped to: the entire point of marking-as-dupe is to avoid answers spread out all over the place
    – Joseph Wright
    Oct 6, 2019 at 9:45

1 Answer 1


I solved this problem by adding this in preamble:

\expandafter\def\csname ver@l3regex.sty\endcsname{} 
  • 5
    Just to make other people aware of this. This is also the workaround proposed by Joseph in tex.stackexchange.com/a/468975/35864. It will pretend that the package l3regex has been loaded (the package was merged into the expl3 kernel so need not be loaded separately any more). Most packages should have been updated to use the new syntax. But if you are stuck with code that can't be updated for some reason this might be reasonable.
    – moewe
    May 18, 2019 at 12:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.