diff --git a/meson.build b/meson.build
index 5570a8a1f39..3dc876413d0 100644
--- a/meson.build
+++ b/meson.build
@@ -1613,9 +1613,12 @@ endif
 dep_m = cc.find_library('m', required : false)
 
 if host_machine.system() == 'windows'
-  dep_regex = meson.get_compiler('c').find_library('regex', required : false)
+  dep_regex = declare_dependency(dependencies : [dependency('regex', required : false)], link_args : ['-liconv'])
   if not dep_regex.found()
-    dep_regex = declare_dependency(compile_args : ['-DNO_REGEX'])
+    dep_regex = meson.get_compiler('c').find_library('regex', required : false)
+    if not dep_regex.found()
+      dep_regex = declare_dependency(compile_args : ['-DNO_REGEX'])
+    endif
   endif
 else
   dep_regex = null_dep

diff --git a/meson.build b/meson.build
index cdff0312e56..46efce97533 100644
--- a/meson.build
+++ b/meson.build
@@ -1566,7 +1566,12 @@ endif
 dep_m = cc.find_library('m', required : false)
 
 if host_machine.system() == 'windows'
-  dep_regex = meson.get_compiler('c').find_library('regex', required : false)
+  dep_part_regex = dependency('regex', required : false)
+  if dep_part_regex.found()
+    dep_regex = declare_dependency(dependencies : [dep_part_regex], link_args : ['-liconv'])
+  else
+    dep_regex = meson.get_compiler('c').find_library('regex', required : false)
+  endif
   if not dep_regex.found()
     dep_regex = declare_dependency(compile_args : ['-DNO_REGEX'])
   endif

Fix regex linking patch breaking MSVC build
Fix regex linking patch breaking MSVC build
