mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-10-22 07:21:21 +00:00
regexes: conversion from std::regex to jpcre2: extract/*
This commit is contained in:
parent
43473f1a3e
commit
108f7a257c
@ -16,6 +16,7 @@
|
||||
#include "common/ebml.h"
|
||||
#include "common/iso639.h"
|
||||
#include "common/list_utils.h"
|
||||
#include "common/regex.h"
|
||||
#include "common/strings/formatting.h"
|
||||
#include "common/strings/parsing.h"
|
||||
#include "common/translation.h"
|
||||
@ -339,10 +340,10 @@ extract_cli_parser_c::add_extraction_spec() {
|
||||
&& (options_c::em_attachments != m_current_mode->m_extraction_mode))
|
||||
mxerror(fmt::format(Y("Unrecognized command line option '{0}'.\n"), m_current_arg));
|
||||
|
||||
std::regex s_track_id_re("^(\\d+)(:(.+))?$");
|
||||
mtx::regex::jp::Regex s_track_id_re{"^(\\d+)(?::(.+))?$"};
|
||||
|
||||
std::smatch matches;
|
||||
if (!std::regex_search(m_current_arg, matches, s_track_id_re)) {
|
||||
mtx::regex::jp::VecNum matches;
|
||||
if (!mtx::regex::match(m_current_arg, matches, s_track_id_re)) {
|
||||
if (options_c::em_attachments == m_current_mode->m_extraction_mode)
|
||||
mxerror(fmt::format(Y("Invalid attachment ID/file name specification in argument '{0}'.\n"), m_current_arg));
|
||||
else
|
||||
@ -351,15 +352,15 @@ extract_cli_parser_c::add_extraction_spec() {
|
||||
|
||||
track_spec_t track;
|
||||
|
||||
mtx::string::parse_number(matches[1].str(), track.tid);
|
||||
mtx::string::parse_number(matches[0][1], track.tid);
|
||||
|
||||
if (m_used_tids[m_current_mode->m_extraction_mode][track.tid])
|
||||
mxerror(fmt::format(Y("The ID '{0}' has already been used for another destination file.\n"), track.tid));
|
||||
m_used_tids[m_current_mode->m_extraction_mode][track.tid] = true;
|
||||
|
||||
std::string output_file_name;
|
||||
if (matches[3].matched)
|
||||
output_file_name = matches[3].str();
|
||||
if (!matches[0][2].empty())
|
||||
output_file_name = matches[0][2];
|
||||
|
||||
if (output_file_name.empty()) {
|
||||
if (options_c::em_attachments == m_current_mode->m_extraction_mode)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "common/mm_file_io.h"
|
||||
#include "common/mm_proxy_io.h"
|
||||
#include "common/mm_text_io.h"
|
||||
#include "common/regex.h"
|
||||
#include "common/strings/editing.h"
|
||||
#include "common/strings/formatting.h"
|
||||
#include "common/strings/parsing.h"
|
||||
@ -52,7 +53,7 @@ xtr_srt_c::handle_frame(xtr_frame_t &f) {
|
||||
m_entry.m_timestamp = f.timestamp;
|
||||
m_entry.m_duration = f.duration;
|
||||
m_entry.m_text = m_conv->native(f.frame->to_string());
|
||||
m_entry.m_text = mtx::string::strip_copy(std::regex_replace(m_entry.m_text, std::regex{"\r+"}, ""), true);
|
||||
m_entry.m_text = mtx::string::strip_copy(mtx::regex::replace(m_entry.m_text, mtx::regex::jp::Regex{"\r+"}, "g", ""), true);
|
||||
|
||||
if (m_entry.m_duration && !m_entry.m_text.empty())
|
||||
flush_entry();
|
||||
@ -267,7 +268,7 @@ xtr_usf_c::xtr_usf_c(const std::string &codec_id,
|
||||
if (m_sub_charset.empty())
|
||||
m_sub_charset = "UTF-8";
|
||||
|
||||
m_simplified_sub_charset = std::regex_replace(balg::to_lower_copy(m_sub_charset), std::regex("[^a-z0-9]+"), "");
|
||||
m_simplified_sub_charset = mtx::regex::replace(balg::to_lower_copy(m_sub_charset), mtx::regex::jp::Regex("[^a-z0-9]+"), "g", "");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "common/mm_io_x.h"
|
||||
#include "common/mm_proxy_io.h"
|
||||
#include "common/mm_write_buffer_io.h"
|
||||
#include "common/regex.h"
|
||||
#include "common/w64.h"
|
||||
#include "extract/xtr_wav.h"
|
||||
|
||||
@ -39,7 +40,7 @@ xtr_wav_c::create_file(xtr_base_c *master,
|
||||
libmatroska::KaxTrackEntry &track) {
|
||||
init_content_decoder(track);
|
||||
|
||||
m_w64_requested = std::regex_search(get_file_name().string(), std::regex{"\\.[wW]64$"});
|
||||
m_w64_requested = mtx::regex::match(get_file_name().string(), mtx::regex::jp::Regex{"\\.[wW]64$"});
|
||||
m_channels = kt_get_a_channels(track);
|
||||
m_sfreq = kt_get_a_sfreq(track);
|
||||
m_bps = kt_get_a_bps(track);
|
||||
|
Loading…
Reference in New Issue
Block a user