boost::algorithm::split_regex doesn't work with boost::u32regex.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Tái hiện hành vi từ src.cpp bằng cấu hình trong CMakeLists.txt, so sánh split_regex với u32regex_replace trên mẫu UTF-8. Bắt đầu từ điểm vào boost::algorithm split_regex và phần xử lý regex của nó; hoàn thành khi mẫu được tách thành các token mong đợi và một bài kiểm thử hồi quy bao quát hành vi này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I want to split a UTF-8 string into tokens. However it looks like that split_regex() failed and just return original string. I also tried u32regex_replace() and it indeed replaced successfully.
src.cpp:
// CutWord.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include<vector>
#include<string>
#include <boost/algorithm/string.hpp>
#include<boost/algorithm/string/regex.hpp>
#include <boost/regex/icu.hpp>
#include<regex>
using namespace std;
int main()
{
string str="数学。数学。数学。";
//Split
vector<string> vs;
//regexU3 stores expression.
boost::u32regex regexU32= boost::make_u32regex("。");
boost::split_regex(vs, str,regexU32);
cout<<vs.size()<<endl; //only return 1.
//Check if u32regex_replace works.
string nsub=".";
string nstr=u32regex_replace(str, regexU32, nsub);
cout<<nstr<<endl;
};
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(main)
set(CMAKE_C_COMPILER /usr/bin/gcc CACHE PATH "" FORCE)
set(CMAKE_CXX_COMPILER /usr/bin/g++ CACHE PATH "" FORCE)
include_directories("/usr/local/include")
include_directories("./include")
add_executable(mp src.cpp)
#ICU
find_package(ICU COMPONENTS i18n io dt in uc)
target_link_libraries(mp ${ICU_LIBRARIES})
#boost
find_package( Boost COMPONENTS regex)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
target_link_libraries( mp ${Boost_LIBRARIES} )
target_compile_features(mp PUBLIC cxx_std_20)
add_custom_command(TARGET mp POST_BUILD
COMMAND echo "----------------------------------------------"
COMMAND ./mp
COMMAND echo "----------------------------------------------")
- Ngôn ngữ chính
- C++
- Star
- 131
- Fork
- 117
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/algorithm
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
variadic min/max/minmax Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
fast variadic string-concat Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Automated formatting Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của boostorg/algorithm
Issue tương tự
-
ai_reviewed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ydb-platform/ydb#53869 · 3 bình luận ·
-
bug cert blocker needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
project-chip/connectedhomeip#74373 ·
-
[request] tracy/0.14.1 Đang mởupstream update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
vllm-project/vllm-ascend#17329 ·