diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce5e3275..f5be324a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,14 @@ # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) name: CI -on: [ push, pull_request ] +on: + push: + branches: + - master + - develop + pull_request: + release: + types: [published, created, edited] jobs: ubuntu-focal: runs-on: ubuntu-20.04 @@ -27,7 +34,7 @@ jobs: - name: Add repository run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - name: Install packages - run: sudo apt install g++-9 g++-10 clang-9 clang-10 + run: sudo apt install g++-9 g++-10 clang-9 clang-10 libicu-dev - name: Checkout main boost run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - name: Update tools/boostdep @@ -78,7 +85,7 @@ jobs: - name: Add repository run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" - name: Install packages - run: sudo apt install g++-7 g++-8 clang-7 clang-8 + run: sudo apt install g++-7 g++-8 clang-7 clang-8 libicu-dev - name: Checkout main boost run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - name: Update tools/boostdep @@ -331,6 +338,8 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: '0' + - name: Install packages + run: sudo apt install libicu-dev - name: Checkout main boost run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - name: Update tools/boostdep @@ -352,3 +361,17 @@ jobs: cmake .. cmake --build . cmake --build . --target check + rm -rf * + echo Standalone configuration + cmake -DBOOST_REGEX_STANDALONE=on .. + cmake --build . + cmake --build . --target check + cd ../../cmake_subdir_test_icu && mkdir __build__ && cd __build__ + cmake .. + cmake --build . + cmake --build . --target check + rm -rf * + echo Standalone configuration + cmake -DBOOST_REGEX_STANDALONE=on .. + cmake --build . + cmake --build . --target check diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fc093ef..ccd42230 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,11 +13,57 @@ add_library(Boost::regex ALIAS boost_regex) target_include_directories(boost_regex INTERFACE include) -target_link_libraries(boost_regex - INTERFACE - Boost::config - Boost::throw_exception - Boost::predef - Boost::assert -) +option(BOOST_REGEX_STANDALONE "Boost.Regex: Enable Standalone Mode (i.e. no Boost dependencies)") + +if(NOT BOOST_REGEX_STANDALONE) + + target_link_libraries(boost_regex + INTERFACE + Boost::config + Boost::throw_exception + Boost::predef + Boost::assert + ) + +else() + + target_compile_definitions(boost_regex + INTERFACE BOOST_REGEX_STANDALONE + ) + +endif() + +find_package(ICU COMPONENTS data i18n uc QUIET) +#option(BOOST_REGEX_ENABLE_ICU "Boost.Regex: enable ICU support" ${ICU_FOUND}) + +if(ICU_FOUND) + + add_library(boost_regex_icu INTERFACE) + add_library(Boost::regex_icu ALIAS boost_regex_icu) + + target_include_directories(boost_regex_icu INTERFACE include) + + if(NOT BOOST_REGEX_STANDALONE) + + target_link_libraries(boost_regex_icu + INTERFACE + Boost::config + Boost::throw_exception + Boost::predef + Boost::assert + ) + + else() + + target_compile_definitions(boost_regex_icu + INTERFACE BOOST_REGEX_STANDALONE + ) + + endif() + + find_package(ICU COMPONENTS data i18n uc REQUIRED) + + target_link_libraries(boost_regex_icu INTERFACE ICU::data ICU::i18n ICU::uc) + +endif() diff --git a/doc/html/boost_regex/background.html b/doc/html/boost_regex/background.html index 426e00dc..56e8ac4e 100644 --- a/doc/html/boost_regex/background.html +++ b/doc/html/boost_regex/background.html @@ -4,8 +4,8 @@ Background Information - - + + diff --git a/doc/html/boost_regex/background/acknowledgements.html b/doc/html/boost_regex/background/acknowledgements.html index af25e802..a129b3ff 100644 --- a/doc/html/boost_regex/background/acknowledgements.html +++ b/doc/html/boost_regex/background/acknowledgements.html @@ -4,7 +4,7 @@ Acknowledgements - + diff --git a/doc/html/boost_regex/background/examples.html b/doc/html/boost_regex/background/examples.html index 4c8fb18f..5222e586 100644 --- a/doc/html/boost_regex/background/examples.html +++ b/doc/html/boost_regex/background/examples.html @@ -4,7 +4,7 @@ Test and Example Programs - + diff --git a/doc/html/boost_regex/background/faq.html b/doc/html/boost_regex/background/faq.html index c5c60367..9928883c 100644 --- a/doc/html/boost_regex/background/faq.html +++ b/doc/html/boost_regex/background/faq.html @@ -4,7 +4,7 @@ FAQ - + diff --git a/doc/html/boost_regex/background/futher.html b/doc/html/boost_regex/background/futher.html index 14f59e3f..6501b1be 100644 --- a/doc/html/boost_regex/background/futher.html +++ b/doc/html/boost_regex/background/futher.html @@ -4,7 +4,7 @@ References and Further Information - + diff --git a/doc/html/boost_regex/background/headers.html b/doc/html/boost_regex/background/headers.html index 88707122..ea964e17 100644 --- a/doc/html/boost_regex/background/headers.html +++ b/doc/html/boost_regex/background/headers.html @@ -4,7 +4,7 @@ Headers - + diff --git a/doc/html/boost_regex/background/history.html b/doc/html/boost_regex/background/history.html index 8421ab54..f329fd41 100644 --- a/doc/html/boost_regex/background/history.html +++ b/doc/html/boost_regex/background/history.html @@ -4,7 +4,7 @@ History - + @@ -36,6 +36,33 @@

+ Boost.Regex-7.0.0 + (Boost-1.78.0) +
+
+
+ + Boost.Regex-6.0.0 + (Boost-1.77.0) +
+
+
+ Boost.Regex-5.1.4 (Boost-172.0)
@@ -43,7 +70,7 @@ Minor build fixes, see #89.
- + Boost.Regex-5.1.3 (Boost-1.64.0)
@@ -57,7 +84,7 @@
- + Boost.Regex-5.1.2 (Boost-1.62.0)
@@ -78,7 +105,7 @@
- + Boost.Regex-5.1.1 (Boost-1.61.0)
@@ -86,7 +113,7 @@ Change to lockfree implementation of memory cache, see PR#23.
- + Boost.Regex-5.1.0 (Boost-1.60.0)
@@ -109,7 +136,7 @@
- + Boost.Regex-5.0.1 (Boost-1.58.0)
@@ -142,7 +169,7 @@
- + Boost.Regex-5.0.0 (Boost-1.56.0)
@@ -175,14 +202,14 @@
- + Boost-1.54

Fixed issue #8569.

- + Boost-1.53

@@ -190,7 +217,7 @@ #7644.

- + Boost-1.51

@@ -200,7 +227,7 @@ #6346.

- + Boost-1.50

@@ -209,7 +236,7 @@ expression.

- + Boost-1.48

@@ -219,7 +246,7 @@ #5736.

- + Boost 1.47
@@ -232,7 +259,7 @@ #5504.

- + Boost 1.44
@@ -251,7 +278,7 @@ #3890

- + Boost 1.42
@@ -280,7 +307,7 @@
- + Boost 1.40
@@ -289,7 +316,7 @@ branch resets and recursive regular expressions.
- + Boost 1.38
@@ -317,7 +344,7 @@
- + Boost 1.34
@@ -340,7 +367,7 @@
- + Boost 1.33.1
@@ -410,7 +437,7 @@
- + Boost 1.33.0
@@ -465,7 +492,7 @@
- + Boost 1.32.1
@@ -473,7 +500,7 @@ Fixed bug in partial matches of bounded repeats of '.'.
- + Boost 1.31.0
diff --git a/doc/html/boost_regex/background/locale.html b/doc/html/boost_regex/background/locale.html index e679a550..5d5f0cd2 100644 --- a/doc/html/boost_regex/background/locale.html +++ b/doc/html/boost_regex/background/locale.html @@ -4,7 +4,7 @@ Localization - + diff --git a/doc/html/boost_regex/background/performance.html b/doc/html/boost_regex/background/performance.html index 3a0ca9ad..e84f6465 100644 --- a/doc/html/boost_regex/background/performance.html +++ b/doc/html/boost_regex/background/performance.html @@ -4,7 +4,7 @@ Performance - + diff --git a/doc/html/boost_regex/background/performance/section_id1378460593.html b/doc/html/boost_regex/background/performance/section_id1378460593.html index 872020dc..60b9852e 100644 --- a/doc/html/boost_regex/background/performance/section_id1378460593.html +++ b/doc/html/boost_regex/background/performance/section_id1378460593.html @@ -4,7 +4,7 @@ Testing simple leftmost-longest matches (platform = linux, compiler = GNU C++ version 6.3.0) - + diff --git a/doc/html/boost_regex/background/performance/section_id1675827111.html b/doc/html/boost_regex/background/performance/section_id1675827111.html index 72b2bc8c..43cafa56 100644 --- a/doc/html/boost_regex/background/performance/section_id1675827111.html +++ b/doc/html/boost_regex/background/performance/section_id1675827111.html @@ -4,7 +4,7 @@ Testing Perl searches (platform = linux, compiler = GNU C++ version 6.3.0) - + diff --git a/doc/html/boost_regex/background/performance/section_id3141719723.html b/doc/html/boost_regex/background/performance/section_id3141719723.html index 129834c6..b9c91f9d 100644 --- a/doc/html/boost_regex/background/performance/section_id3141719723.html +++ b/doc/html/boost_regex/background/performance/section_id3141719723.html @@ -4,7 +4,7 @@ Testing simple leftmost-longest matches (platform = Windows x64, compiler = Microsoft Visual C++ version 14.1) - + diff --git a/doc/html/boost_regex/background/performance/section_id3258595385.html b/doc/html/boost_regex/background/performance/section_id3258595385.html index 716f62b9..ecc996e6 100644 --- a/doc/html/boost_regex/background/performance/section_id3258595385.html +++ b/doc/html/boost_regex/background/performance/section_id3258595385.html @@ -4,7 +4,7 @@ Testing leftmost-longest searches (platform = Windows x64, compiler = Microsoft Visual C++ version 14.1) - + diff --git a/doc/html/boost_regex/background/performance/section_id3261825021.html b/doc/html/boost_regex/background/performance/section_id3261825021.html index b71be600..b243694a 100644 --- a/doc/html/boost_regex/background/performance/section_id3261825021.html +++ b/doc/html/boost_regex/background/performance/section_id3261825021.html @@ -4,7 +4,7 @@ Testing simple Perl matches (platform = linux, compiler = GNU C++ version 6.3.0) - + diff --git a/doc/html/boost_regex/background/performance/section_id3752650613.html b/doc/html/boost_regex/background/performance/section_id3752650613.html index 67b83440..ac11c594 100644 --- a/doc/html/boost_regex/background/performance/section_id3752650613.html +++ b/doc/html/boost_regex/background/performance/section_id3752650613.html @@ -4,7 +4,7 @@ Testing Perl searches (platform = Windows x64, compiler = Microsoft Visual C++ version 14.1) - + diff --git a/doc/html/boost_regex/background/performance/section_id4128344975.html b/doc/html/boost_regex/background/performance/section_id4128344975.html index 89720415..d77b3ae2 100644 --- a/doc/html/boost_regex/background/performance/section_id4128344975.html +++ b/doc/html/boost_regex/background/performance/section_id4128344975.html @@ -4,7 +4,7 @@ Testing simple Perl matches (platform = Windows x64, compiler = Microsoft Visual C++ version 14.1) - + diff --git a/doc/html/boost_regex/background/performance/section_id4148872883.html b/doc/html/boost_regex/background/performance/section_id4148872883.html index 8495bf1a..f9876309 100644 --- a/doc/html/boost_regex/background/performance/section_id4148872883.html +++ b/doc/html/boost_regex/background/performance/section_id4148872883.html @@ -4,7 +4,7 @@ Testing leftmost-longest searches (platform = linux, compiler = GNU C++ version 6.3.0) - + diff --git a/doc/html/boost_regex/background/redist.html b/doc/html/boost_regex/background/redist.html index ef12c43f..4f85a62a 100644 --- a/doc/html/boost_regex/background/redist.html +++ b/doc/html/boost_regex/background/redist.html @@ -4,7 +4,7 @@ Redistributables - + diff --git a/doc/html/boost_regex/background/standards.html b/doc/html/boost_regex/background/standards.html index aeecebf3..817b51fb 100644 --- a/doc/html/boost_regex/background/standards.html +++ b/doc/html/boost_regex/background/standards.html @@ -4,7 +4,7 @@ Standards Conformance - + diff --git a/doc/html/boost_regex/background/thread_safety.html b/doc/html/boost_regex/background/thread_safety.html index 1f1fb819..7ba59e9a 100644 --- a/doc/html/boost_regex/background/thread_safety.html +++ b/doc/html/boost_regex/background/thread_safety.html @@ -4,7 +4,7 @@ Thread Safety - + diff --git a/doc/html/boost_regex/captures.html b/doc/html/boost_regex/captures.html index 55e59822..ef532ae5 100644 --- a/doc/html/boost_regex/captures.html +++ b/doc/html/boost_regex/captures.html @@ -4,8 +4,8 @@ Understanding Marked Sub-Expressions and Captures - - + + diff --git a/doc/html/boost_regex/configuration.html b/doc/html/boost_regex/configuration.html index bfc70b20..0f2e9468 100644 --- a/doc/html/boost_regex/configuration.html +++ b/doc/html/boost_regex/configuration.html @@ -4,9 +4,9 @@ Configuration - - - + + + @@ -28,6 +28,8 @@
Compiler Setup
+
Use in Standalone + Mode (without the rest of Boost)
Locale and traits class selection
Algorithm Tuning
diff --git a/doc/html/boost_regex/configuration/compiler.html b/doc/html/boost_regex/configuration/compiler.html index 59cd9329..54af44a7 100644 --- a/doc/html/boost_regex/configuration/compiler.html +++ b/doc/html/boost_regex/configuration/compiler.html @@ -4,10 +4,10 @@ Compiler Setup - + - + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext

@@ -44,7 +44,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_regex/configuration/locale.html b/doc/html/boost_regex/configuration/locale.html index eb3ba937..2a482463 100644 --- a/doc/html/boost_regex/configuration/locale.html +++ b/doc/html/boost_regex/configuration/locale.html @@ -4,9 +4,9 @@ Locale and traits class selection - + - + @@ -20,7 +20,7 @@
-PrevUpHomeNext +PrevUpHomeNext

@@ -103,7 +103,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_regex/configuration/tuning.html b/doc/html/boost_regex/configuration/tuning.html index 30ddc99f..608db62e 100644 --- a/doc/html/boost_regex/configuration/tuning.html +++ b/doc/html/boost_regex/configuration/tuning.html @@ -4,7 +4,7 @@ Algorithm Tuning - + diff --git a/doc/html/boost_regex/format.html b/doc/html/boost_regex/format.html index bbd3e55a..1192a07f 100644 --- a/doc/html/boost_regex/format.html +++ b/doc/html/boost_regex/format.html @@ -4,8 +4,8 @@ Search and Replace Format String Syntax - - + + diff --git a/doc/html/boost_regex/format/boost_format_syntax.html b/doc/html/boost_regex/format/boost_format_syntax.html index 32b841ab..3dfdf7fb 100644 --- a/doc/html/boost_regex/format/boost_format_syntax.html +++ b/doc/html/boost_regex/format/boost_format_syntax.html @@ -4,7 +4,7 @@ Boost-Extended Format String Syntax - + diff --git a/doc/html/boost_regex/format/perl_format.html b/doc/html/boost_regex/format/perl_format.html index c0b9698b..ce11ccd0 100644 --- a/doc/html/boost_regex/format/perl_format.html +++ b/doc/html/boost_regex/format/perl_format.html @@ -4,7 +4,7 @@ Perl Format String Syntax - + diff --git a/doc/html/boost_regex/format/sed_format.html b/doc/html/boost_regex/format/sed_format.html index dd37fbb7..3dfac65c 100644 --- a/doc/html/boost_regex/format/sed_format.html +++ b/doc/html/boost_regex/format/sed_format.html @@ -4,7 +4,7 @@ Sed Format String Syntax - + diff --git a/doc/html/boost_regex/install.html b/doc/html/boost_regex/install.html index 7070210a..8088bc13 100644 --- a/doc/html/boost_regex/install.html +++ b/doc/html/boost_regex/install.html @@ -4,8 +4,8 @@ Building and Installing the Library - - + + @@ -73,17 +73,52 @@ Define BOOST_REGEX_STANDALONE when building.

+

+ If you are using this library with ICU, note that since it is now header only, + it will be up to you to link to the ICU libraries if you use <boost/regex/icu.hpp> unless you are using the supplied CMake + script. +

- C++03 users only (Deprecated) Building with bjam + Usage + with CMake

- This is now the preferred method for building and installing this library, - please refer to the getting + The library comes with a very basic CMakeLists.txt that allows this library + to be used from other CMake scripts. +

+

+ CMakeLists.txt defines two targets: +

+
    +
  • + Boost::regex This is the target to use for normal + header only builds. +
  • +
  • + Boost::regex_icu This is the target to use if + you are using <boost/regex/icu.hpp> in your code, and wish to have the + ICU dependencies taken care of for you. +
  • +
+

+ There is also one configuration option: +

+
  • + BOOST_REGEX_STANDALONE when set then no other Boost libraries are targeted + as dependencies, and Boost.Regex is placed in standalone mode. +
+
+ + C++03 users only (DEPRECATED) Building with bjam +
+

+ This is now the preferred method for building and installing legacy versions + this library, please refer to the getting started guide for more information.

- + Building With Unicode and ICU Support
@@ -293,7 +328,7 @@ header-include and linker-search paths).

- + Building from Source
diff --git a/doc/html/boost_regex/intro.html b/doc/html/boost_regex/intro.html index af487a5d..2e674614 100644 --- a/doc/html/boost_regex/intro.html +++ b/doc/html/boost_regex/intro.html @@ -4,8 +4,8 @@ Introduction and Overview - - + + diff --git a/doc/html/boost_regex/partial_matches.html b/doc/html/boost_regex/partial_matches.html index 3b2fabbd..67ab8382 100644 --- a/doc/html/boost_regex/partial_matches.html +++ b/doc/html/boost_regex/partial_matches.html @@ -4,8 +4,8 @@ Partial Matches - - + + diff --git a/doc/html/boost_regex/ref.html b/doc/html/boost_regex/ref.html index ef2f7259..913f1460 100644 --- a/doc/html/boost_regex/ref.html +++ b/doc/html/boost_regex/ref.html @@ -4,8 +4,8 @@ Reference - - + + diff --git a/doc/html/boost_regex/ref/bad_expression.html b/doc/html/boost_regex/ref/bad_expression.html index 9eca074b..c53c53c6 100644 --- a/doc/html/boost_regex/ref/bad_expression.html +++ b/doc/html/boost_regex/ref/bad_expression.html @@ -4,7 +4,7 @@ bad_expression - + diff --git a/doc/html/boost_regex/ref/basic_regex.html b/doc/html/boost_regex/ref/basic_regex.html index 3b590011..bb7b74b0 100644 --- a/doc/html/boost_regex/ref/basic_regex.html +++ b/doc/html/boost_regex/ref/basic_regex.html @@ -4,7 +4,7 @@ basic_regex - + diff --git a/doc/html/boost_regex/ref/concepts.html b/doc/html/boost_regex/ref/concepts.html index ea87d335..31a14caa 100644 --- a/doc/html/boost_regex/ref/concepts.html +++ b/doc/html/boost_regex/ref/concepts.html @@ -4,7 +4,7 @@ Concepts - + diff --git a/doc/html/boost_regex/ref/concepts/charT_concept.html b/doc/html/boost_regex/ref/concepts/charT_concept.html index 32c4694d..22027035 100644 --- a/doc/html/boost_regex/ref/concepts/charT_concept.html +++ b/doc/html/boost_regex/ref/concepts/charT_concept.html @@ -4,7 +4,7 @@ charT Requirements - + diff --git a/doc/html/boost_regex/ref/concepts/iterator_concepts.html b/doc/html/boost_regex/ref/concepts/iterator_concepts.html index d93ed168..29686ba5 100644 --- a/doc/html/boost_regex/ref/concepts/iterator_concepts.html +++ b/doc/html/boost_regex/ref/concepts/iterator_concepts.html @@ -4,7 +4,7 @@ Iterator Requirements - + diff --git a/doc/html/boost_regex/ref/concepts/traits_concept.html b/doc/html/boost_regex/ref/concepts/traits_concept.html index c8e71c94..ec08ca00 100644 --- a/doc/html/boost_regex/ref/concepts/traits_concept.html +++ b/doc/html/boost_regex/ref/concepts/traits_concept.html @@ -4,7 +4,7 @@ Traits Class Requirements - + diff --git a/doc/html/boost_regex/ref/deprecated.html b/doc/html/boost_regex/ref/deprecated.html index ca0c184b..0c8c050d 100644 --- a/doc/html/boost_regex/ref/deprecated.html +++ b/doc/html/boost_regex/ref/deprecated.html @@ -4,7 +4,7 @@ Deprecated Interfaces - + diff --git a/doc/html/boost_regex/ref/deprecated/old_regex.html b/doc/html/boost_regex/ref/deprecated/old_regex.html index 029957fb..dc157a1a 100644 --- a/doc/html/boost_regex/ref/deprecated/old_regex.html +++ b/doc/html/boost_regex/ref/deprecated/old_regex.html @@ -4,7 +4,7 @@ High Level Class RegEx (Deprecated) - + diff --git a/doc/html/boost_regex/ref/deprecated/regex_format.html b/doc/html/boost_regex/ref/deprecated/regex_format.html index f2f38a35..c92f8b2d 100644 --- a/doc/html/boost_regex/ref/deprecated/regex_format.html +++ b/doc/html/boost_regex/ref/deprecated/regex_format.html @@ -4,7 +4,7 @@ regex_format (Deprecated) - + diff --git a/doc/html/boost_regex/ref/deprecated/regex_grep.html b/doc/html/boost_regex/ref/deprecated/regex_grep.html index 8672b0ce..4ab54d04 100644 --- a/doc/html/boost_regex/ref/deprecated/regex_grep.html +++ b/doc/html/boost_regex/ref/deprecated/regex_grep.html @@ -4,7 +4,7 @@ regex_grep (Deprecated) - + diff --git a/doc/html/boost_regex/ref/deprecated/regex_split.html b/doc/html/boost_regex/ref/deprecated/regex_split.html index fe12903e..cb514d3c 100644 --- a/doc/html/boost_regex/ref/deprecated/regex_split.html +++ b/doc/html/boost_regex/ref/deprecated/regex_split.html @@ -4,7 +4,7 @@ regex_split (deprecated) - + diff --git a/doc/html/boost_regex/ref/error_type.html b/doc/html/boost_regex/ref/error_type.html index ee125f73..4352b36d 100644 --- a/doc/html/boost_regex/ref/error_type.html +++ b/doc/html/boost_regex/ref/error_type.html @@ -4,7 +4,7 @@ error_type - + diff --git a/doc/html/boost_regex/ref/internals.html b/doc/html/boost_regex/ref/internals.html index 05adf247..623f5bad 100644 --- a/doc/html/boost_regex/ref/internals.html +++ b/doc/html/boost_regex/ref/internals.html @@ -4,7 +4,7 @@ Internal Details - + diff --git a/doc/html/boost_regex/ref/internals/uni_iter.html b/doc/html/boost_regex/ref/internals/uni_iter.html index 6d59d683..1fa31efc 100644 --- a/doc/html/boost_regex/ref/internals/uni_iter.html +++ b/doc/html/boost_regex/ref/internals/uni_iter.html @@ -4,7 +4,7 @@ Unicode Iterators - + diff --git a/doc/html/boost_regex/ref/match_flag_type.html b/doc/html/boost_regex/ref/match_flag_type.html index 3f9b07f5..eacee16f 100644 --- a/doc/html/boost_regex/ref/match_flag_type.html +++ b/doc/html/boost_regex/ref/match_flag_type.html @@ -4,7 +4,7 @@ match_flag_type - + diff --git a/doc/html/boost_regex/ref/match_results.html b/doc/html/boost_regex/ref/match_results.html index 760d6388..d9583536 100644 --- a/doc/html/boost_regex/ref/match_results.html +++ b/doc/html/boost_regex/ref/match_results.html @@ -4,7 +4,7 @@ match_results - + diff --git a/doc/html/boost_regex/ref/non_std_strings.html b/doc/html/boost_regex/ref/non_std_strings.html index d65da1a7..9de0357c 100644 --- a/doc/html/boost_regex/ref/non_std_strings.html +++ b/doc/html/boost_regex/ref/non_std_strings.html @@ -4,7 +4,7 @@ Interfacing With Non-Standard String Types - + diff --git a/doc/html/boost_regex/ref/non_std_strings/icu.html b/doc/html/boost_regex/ref/non_std_strings/icu.html index 18c53182..4eab757a 100644 --- a/doc/html/boost_regex/ref/non_std_strings/icu.html +++ b/doc/html/boost_regex/ref/non_std_strings/icu.html @@ -4,7 +4,7 @@ Working With Unicode and ICU String Types - + diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/intro.html b/doc/html/boost_regex/ref/non_std_strings/icu/intro.html index 6578a44b..a4e80e1e 100644 --- a/doc/html/boost_regex/ref/non_std_strings/icu/intro.html +++ b/doc/html/boost_regex/ref/non_std_strings/icu/intro.html @@ -4,7 +4,7 @@ Introduction to using Regex with ICU - + @@ -38,9 +38,7 @@

In order to use this header you will need the ICU - library, and you will need to have built the Boost.Regex library - with ICU - support enabled. + library.

The header will enable you to: @@ -59,6 +57,11 @@ UTF-16 or UTF-32.

+

+ CMake users should link to the Boost::regex_icu + target in our CMakeLists.txt in order to have ICU dependencies taken + care of when using this header. +

diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html index 447bed6c..afe9d7a3 100644 --- a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html +++ b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_algo.html @@ -4,7 +4,7 @@ Unicode Regular Expression Algorithms - + diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html index 3496e89d..a8630203 100644 --- a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html +++ b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_iter.html @@ -4,7 +4,7 @@ Unicode Aware Regex Iterators - + diff --git a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_types.html b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_types.html index 5137a787..1aab1bbd 100644 --- a/doc/html/boost_regex/ref/non_std_strings/icu/unicode_types.html +++ b/doc/html/boost_regex/ref/non_std_strings/icu/unicode_types.html @@ -4,7 +4,7 @@ Unicode regular expression types - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings.html index 7318b0c7..92d9b767 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings.html @@ -4,7 +4,7 @@ Using Boost Regex With MFC Strings - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html index 0a4d3d28..a6b64d00 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_algo.html @@ -4,7 +4,7 @@ Overloaded Algorithms For MFC String Types - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_intro.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_intro.html index 4531171e..00fb2acd 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_intro.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_intro.html @@ -4,7 +4,7 @@ Introduction to Boost.Regex and MFC Strings - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html index 3241d399..28da789a 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html @@ -4,7 +4,7 @@ Iterating Over the Matches Within An MFC String - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_create.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_create.html index b149e6fd..869bcf69 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_create.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_create.html @@ -4,7 +4,7 @@ Regular Expression Creation From an MFC String - + diff --git a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_types.html b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_types.html index a31aef42..f5f76e76 100644 --- a/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_types.html +++ b/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_regex_types.html @@ -4,7 +4,7 @@ Regex Types Used With MFC Strings - + diff --git a/doc/html/boost_regex/ref/posix.html b/doc/html/boost_regex/ref/posix.html index 2ffabed1..4ca51ca7 100644 --- a/doc/html/boost_regex/ref/posix.html +++ b/doc/html/boost_regex/ref/posix.html @@ -4,7 +4,7 @@ POSIX Compatible C API's - + diff --git a/doc/html/boost_regex/ref/regex_iterator.html b/doc/html/boost_regex/ref/regex_iterator.html index 39aa982f..f0d69fd3 100644 --- a/doc/html/boost_regex/ref/regex_iterator.html +++ b/doc/html/boost_regex/ref/regex_iterator.html @@ -4,7 +4,7 @@ regex_iterator - + diff --git a/doc/html/boost_regex/ref/regex_match.html b/doc/html/boost_regex/ref/regex_match.html index 7af902e3..e1127cad 100644 --- a/doc/html/boost_regex/ref/regex_match.html +++ b/doc/html/boost_regex/ref/regex_match.html @@ -4,7 +4,7 @@ regex_match - + diff --git a/doc/html/boost_regex/ref/regex_replace.html b/doc/html/boost_regex/ref/regex_replace.html index 660788c5..fec865cf 100644 --- a/doc/html/boost_regex/ref/regex_replace.html +++ b/doc/html/boost_regex/ref/regex_replace.html @@ -4,7 +4,7 @@ regex_replace - + diff --git a/doc/html/boost_regex/ref/regex_search.html b/doc/html/boost_regex/ref/regex_search.html index 219df924..08f58710 100644 --- a/doc/html/boost_regex/ref/regex_search.html +++ b/doc/html/boost_regex/ref/regex_search.html @@ -4,7 +4,7 @@ regex_search - + diff --git a/doc/html/boost_regex/ref/regex_token_iterator.html b/doc/html/boost_regex/ref/regex_token_iterator.html index 52df6907..5e8bdd50 100644 --- a/doc/html/boost_regex/ref/regex_token_iterator.html +++ b/doc/html/boost_regex/ref/regex_token_iterator.html @@ -4,7 +4,7 @@ regex_token_iterator - + diff --git a/doc/html/boost_regex/ref/regex_traits.html b/doc/html/boost_regex/ref/regex_traits.html index 4aeb4206..990403c9 100644 --- a/doc/html/boost_regex/ref/regex_traits.html +++ b/doc/html/boost_regex/ref/regex_traits.html @@ -4,7 +4,7 @@ regex_traits - + diff --git a/doc/html/boost_regex/ref/sub_match.html b/doc/html/boost_regex/ref/sub_match.html index ce0c8f7a..03f884d2 100644 --- a/doc/html/boost_regex/ref/sub_match.html +++ b/doc/html/boost_regex/ref/sub_match.html @@ -4,7 +4,7 @@ sub_match - + diff --git a/doc/html/boost_regex/ref/syntax_option_type.html b/doc/html/boost_regex/ref/syntax_option_type.html index cf9eea91..90fda68c 100644 --- a/doc/html/boost_regex/ref/syntax_option_type.html +++ b/doc/html/boost_regex/ref/syntax_option_type.html @@ -4,7 +4,7 @@ syntax_option_type - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_basic.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_basic.html index b9566637..80652e33 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_basic.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_basic.html @@ -4,7 +4,7 @@ Options for POSIX Basic Regular Expressions - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_extended.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_extended.html index fbc34d37..6e102bce 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_extended.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_extended.html @@ -4,7 +4,7 @@ Options for POSIX Extended Regular Expressions - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_literal.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_literal.html index 3956e5d6..0f274b5f 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_literal.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_literal.html @@ -4,7 +4,7 @@ Options for Literal Strings - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_overview.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_overview.html index e5431456..42fcaa3d 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_overview.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_overview.html @@ -4,7 +4,7 @@ Overview of syntax_option_type - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_perl.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_perl.html index e66df75a..f611257d 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_perl.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_perl.html @@ -4,7 +4,7 @@ Options for Perl Regular Expressions - + diff --git a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_synopsis.html b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_synopsis.html index 446af451..add41de1 100644 --- a/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_synopsis.html +++ b/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_synopsis.html @@ -4,7 +4,7 @@ syntax_option_type Synopsis - + diff --git a/doc/html/boost_regex/syntax.html b/doc/html/boost_regex/syntax.html index efc5f481..f2812897 100644 --- a/doc/html/boost_regex/syntax.html +++ b/doc/html/boost_regex/syntax.html @@ -4,8 +4,8 @@ Regular Expression Syntax - - + + diff --git a/doc/html/boost_regex/syntax/basic_extended.html b/doc/html/boost_regex/syntax/basic_extended.html index 60d814f3..9161bcde 100644 --- a/doc/html/boost_regex/syntax/basic_extended.html +++ b/doc/html/boost_regex/syntax/basic_extended.html @@ -4,7 +4,7 @@ POSIX Extended Regular Expression Syntax - + diff --git a/doc/html/boost_regex/syntax/basic_syntax.html b/doc/html/boost_regex/syntax/basic_syntax.html index f7067ed5..f2aef14b 100644 --- a/doc/html/boost_regex/syntax/basic_syntax.html +++ b/doc/html/boost_regex/syntax/basic_syntax.html @@ -4,7 +4,7 @@ POSIX Basic Regular Expression Syntax - + diff --git a/doc/html/boost_regex/syntax/character_classes.html b/doc/html/boost_regex/syntax/character_classes.html index 9b072e25..bc8f1933 100644 --- a/doc/html/boost_regex/syntax/character_classes.html +++ b/doc/html/boost_regex/syntax/character_classes.html @@ -4,7 +4,7 @@ Character Class Names - + diff --git a/doc/html/boost_regex/syntax/character_classes/optional_char_class_names.html b/doc/html/boost_regex/syntax/character_classes/optional_char_class_names.html index 061763ef..259d0fc0 100644 --- a/doc/html/boost_regex/syntax/character_classes/optional_char_class_names.html +++ b/doc/html/boost_regex/syntax/character_classes/optional_char_class_names.html @@ -4,7 +4,7 @@ Character classes that are supported by Unicode Regular Expressions - + diff --git a/doc/html/boost_regex/syntax/character_classes/std_char_classes.html b/doc/html/boost_regex/syntax/character_classes/std_char_classes.html index 640c5e10..f6a978a4 100644 --- a/doc/html/boost_regex/syntax/character_classes/std_char_classes.html +++ b/doc/html/boost_regex/syntax/character_classes/std_char_classes.html @@ -4,7 +4,7 @@ Character Classes that are Always Supported - + diff --git a/doc/html/boost_regex/syntax/collating_names.html b/doc/html/boost_regex/syntax/collating_names.html index 9b08b76e..2969f7fa 100644 --- a/doc/html/boost_regex/syntax/collating_names.html +++ b/doc/html/boost_regex/syntax/collating_names.html @@ -4,7 +4,7 @@ Collating Names - + diff --git a/doc/html/boost_regex/syntax/collating_names/digraphs.html b/doc/html/boost_regex/syntax/collating_names/digraphs.html index 3630f6bb..92633356 100644 --- a/doc/html/boost_regex/syntax/collating_names/digraphs.html +++ b/doc/html/boost_regex/syntax/collating_names/digraphs.html @@ -4,7 +4,7 @@ Digraphs - + diff --git a/doc/html/boost_regex/syntax/collating_names/named_unicode.html b/doc/html/boost_regex/syntax/collating_names/named_unicode.html index 8c5e94c9..9d8492c8 100644 --- a/doc/html/boost_regex/syntax/collating_names/named_unicode.html +++ b/doc/html/boost_regex/syntax/collating_names/named_unicode.html @@ -4,7 +4,7 @@ Named Unicode Characters - + diff --git a/doc/html/boost_regex/syntax/collating_names/posix_symbolic_names.html b/doc/html/boost_regex/syntax/collating_names/posix_symbolic_names.html index 4e1e920d..a0c3b969 100644 --- a/doc/html/boost_regex/syntax/collating_names/posix_symbolic_names.html +++ b/doc/html/boost_regex/syntax/collating_names/posix_symbolic_names.html @@ -4,7 +4,7 @@ POSIX Symbolic Names - + diff --git a/doc/html/boost_regex/syntax/leftmost_longest_rule.html b/doc/html/boost_regex/syntax/leftmost_longest_rule.html index 06b8c52c..94600780 100644 --- a/doc/html/boost_regex/syntax/leftmost_longest_rule.html +++ b/doc/html/boost_regex/syntax/leftmost_longest_rule.html @@ -4,7 +4,7 @@ The Leftmost Longest Rule - + diff --git a/doc/html/boost_regex/syntax/perl_syntax.html b/doc/html/boost_regex/syntax/perl_syntax.html index 10e30e5f..05e7e635 100644 --- a/doc/html/boost_regex/syntax/perl_syntax.html +++ b/doc/html/boost_regex/syntax/perl_syntax.html @@ -4,7 +4,7 @@ Perl Regular Expression Syntax - + diff --git a/doc/html/boost_regex/unicode.html b/doc/html/boost_regex/unicode.html index 45be4b66..bff988ae 100644 --- a/doc/html/boost_regex/unicode.html +++ b/doc/html/boost_regex/unicode.html @@ -4,8 +4,8 @@ Unicode and Boost.Regex - - + + @@ -63,11 +63,10 @@

If you have the ICU - library, then Boost.Regex can be configured - to make use of it, and provide a distinct regular expression type (boost::u32regex), - that supports both Unicode specific character properties, and the searching - of text that is encoded in either UTF-8, UTF-16, or UTF-32. See: ICU - string class support. + library, then Boost.Regex provides a distinct regular expression type + (boost::u32regex), that supports both Unicode specific character properties, + and the searching of text that is encoded in either UTF-8, UTF-16, or UTF-32. + See: ICU string class support.

diff --git a/doc/html/index.html b/doc/html/index.html index 49e7612f..da504393 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,10 +1,10 @@ -Boost.Regex 5.1.4 +Boost.Regex 7.0.0 - + @@ -22,7 +22,7 @@

-Boost.Regex 5.1.4

+Boost.Regex 7.0.0

John Maddock

@@ -42,6 +42,8 @@
Configuration
Compiler Setup
+
Use in Standalone + Mode (without the rest of Boost)
Locale and traits class selection
Algorithm Tuning
@@ -213,7 +215,7 @@

- +

Last revised: January 25, 2021 at 11:08:05 GMT

Last revised: October 10, 2021 at 15:39:14 GMT


diff --git a/doc/icu_strings.qbk b/doc/icu_strings.qbk index e38e0431..d13c7880 100644 --- a/doc/icu_strings.qbk +++ b/doc/icu_strings.qbk @@ -18,9 +18,7 @@ contains the data types and algorithms necessary for working with regular expressions in a Unicode aware environment. In order to use this header you will need the -[@http://www.ibm.com/software/globalization/icu/ ICU library], and you will need -to have built the Boost.Regex library with -[link boost_regex.install.building_with_unicode_and_icu_su ICU support enabled]. +[@http://www.ibm.com/software/globalization/icu/ ICU library]. The header will enable you to: @@ -28,6 +26,9 @@ The header will enable you to: * Create regular expressions that support various Unicode data properties, including character classification. * Transparently search Unicode strings that are encoded as either UTF-8, UTF-16 or UTF-32. +CMake users should link to the `Boost::regex_icu` target in our CMakeLists.txt in order to have ICU dependencies +taken care of when using this header. + [endsect] [section:unicode_types Unicode regular expression types] diff --git a/doc/install.qbk b/doc/install.qbk index 041439ef..8648790e 100644 --- a/doc/install.qbk +++ b/doc/install.qbk @@ -35,9 +35,26 @@ in order to do this you must either: then the library will automoatically enter standalone mode. Or: * Define BOOST_REGEX_STANDALONE when building. -[h4 [*C++03 users only (Deprecated)] Building with bjam] +If you are using this library with ICU, note that since it is now header only, it will be up to you +to link to the ICU libraries if you use `` unless you are using the supplied CMake script. -This is now the preferred method for building and installing this library, +[h4 Usage with CMake] + +The library comes with a very basic CMakeLists.txt that allows this library to be used from other CMake scripts. + +CMakeLists.txt defines two targets: + +* `Boost::regex` This is the target to use for normal header only builds. +* `Boost::regex_icu` This is the target to use if you are using `` in your code, and wish to have the ICU dependencies taken care of for you. + +There is also one configuration option: + +* BOOST_REGEX_STANDALONE when set then no other Boost libraries are targeted as dependencies, and Boost.Regex is placed in standalone mode. Invoke CMake +with -DBOOST_REGEX_STANDALONE=on to enable standalone mode. + +[h4 [*C++03 users only (DEPRECATED)] Building with bjam] + +This is now the preferred method for building and installing legacy versions this library, please refer to the [@../../../../more/getting_started.html getting started guide] for more information. diff --git a/doc/unicode.qbk b/doc/unicode.qbk index 2e86ad0c..8ab64fcd 100644 --- a/doc/unicode.qbk +++ b/doc/unicode.qbk @@ -29,10 +29,7 @@ characters, it is not possible to search UTF-8, or even UTF-16 on many platforms If you have the [@http://www.ibm.com/software/globalization/icu/ ICU library], then -Boost.Regex can be -[link boost_regex.install.building_with_unicode_and_icu_su -configured to make use -of it], and provide a distinct regular expression type (boost::u32regex), +Boost.Regex provides a distinct regular expression type (boost::u32regex), that supports both Unicode specific character properties, and the searching of text that is encoded in either UTF-8, UTF-16, or UTF-32. See: [link boost_regex.ref.non_std_strings.icu diff --git a/test/cmake_subdir_test_icu/CMakeLists.txt b/test/cmake_subdir_test_icu/CMakeLists.txt new file mode 100644 index 00000000..62e4f0a6 --- /dev/null +++ b/test/cmake_subdir_test_icu/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2018, 2019 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_subdir_test LANGUAGES CXX) + +add_subdirectory(../.. boostorg/regex) +add_subdirectory(../../../config boostorg/config) +add_subdirectory(../../../core boostorg/core) +add_subdirectory(../../../assert boostorg/assert) +add_subdirectory(../../../throw_exception boostorg/throw_exception) +add_subdirectory(../../../predef boostorg/predef) + +add_executable(quick_icu ../quick_icu.cpp) +target_link_libraries(quick_icu Boost::regex_icu) + +enable_testing() +add_test(quick_icu quick_icu) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $) diff --git a/test/quick.cpp b/test/quick.cpp index 0598823d..649339c7 100644 --- a/test/quick.cpp +++ b/test/quick.cpp @@ -10,7 +10,7 @@ // See library home page at http://www.boost.org/libs/regex #include -#include +#include #include bool validate_card_format(const std::string& s) @@ -37,19 +37,19 @@ int main() { std::string s[ 4 ] = { "0000111122223333", "0000 1111 2222 3333", "0000-1111-2222-3333", "000-1111-2222-3333" }; - BOOST_TEST( !validate_card_format( s[0] ) ); - BOOST_TEST_EQ( machine_readable_card_number( s[0] ), s[0] ); - BOOST_TEST_EQ( human_readable_card_number( s[0] ), s[2] ); + assert(!validate_card_format(s[0])); + assert(machine_readable_card_number(s[0]) == s[0]); + assert(human_readable_card_number(s[0]) == s[2]); - BOOST_TEST( validate_card_format( s[1] ) ); - BOOST_TEST_EQ( machine_readable_card_number( s[1] ), s[0] ); - BOOST_TEST_EQ( human_readable_card_number( s[1] ), s[2] ); + assert(validate_card_format(s[1])); + assert(machine_readable_card_number(s[1]) == s[0]); + assert(human_readable_card_number(s[1]) == s[2]); - BOOST_TEST( validate_card_format( s[2] ) ); - BOOST_TEST_EQ( machine_readable_card_number( s[2] ), s[0] ); - BOOST_TEST_EQ( human_readable_card_number( s[2] ), s[2] ); + assert(validate_card_format(s[2])); + assert(machine_readable_card_number(s[2]) == s[0]); + assert(human_readable_card_number(s[2]) == s[2]); - BOOST_TEST( !validate_card_format( s[3] ) ); + assert(!validate_card_format(s[3])); - return boost::report_errors(); + return 0; } diff --git a/test/quick_icu.cpp b/test/quick_icu.cpp new file mode 100644 index 00000000..74058c00 --- /dev/null +++ b/test/quick_icu.cpp @@ -0,0 +1,55 @@ + +// Copyright 1998-2002 John Maddock +// Copyright 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +// See library home page at http://www.boost.org/libs/regex + +#include +#include +#include + +bool validate_card_format(const std::string& s) +{ + static const boost::u32regex e = boost::make_u32regex("(\\d{4}[- ]){3}\\d{4}"); + return boost::u32regex_match(s, e); +} + +const boost::u32regex card_rx = boost::make_u32regex("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z"); +const std::string machine_format("\\1\\2\\3\\4"); +const std::string human_format("\\1-\\2-\\3-\\4"); + +std::string machine_readable_card_number(const std::string& s) +{ + return boost::u32regex_replace(s, card_rx, machine_format, boost::match_default | boost::format_sed); +} + +std::string human_readable_card_number(const std::string& s) +{ + return boost::u32regex_replace(s, card_rx, human_format, boost::match_default | boost::format_sed); +} + +int main() +{ + std::string s[ 4 ] = { "0000111122223333", "0000 1111 2222 3333", "0000-1111-2222-3333", "000-1111-2222-3333" }; + + assert( !validate_card_format( s[0] ) ); + assert( machine_readable_card_number( s[0] ) == s[0] ); + assert( human_readable_card_number( s[0] ) == s[2] ); + + assert( validate_card_format( s[1] ) ); + assert( machine_readable_card_number( s[1] ) == s[0] ); + assert( human_readable_card_number( s[1] ) == s[2] ); + + assert( validate_card_format( s[2] ) ); + assert( machine_readable_card_number( s[2] ) == s[0] ); + assert( human_readable_card_number( s[2] ) == s[2] ); + + assert( !validate_card_format( s[3] ) ); + + return 0; +}