ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uregex.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 2004-2013, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * file name: uregex.h
7 * encoding: US-ASCII
8 * indentation:4
9 *
10 * created on: 2004mar09
11 * created by: Andy Heninger
12 *
13 * ICU Regular Expressions, API for C
14 */
15
23 #ifndef UREGEX_H
24 #define UREGEX_H
25
26 #include "unicode/utext.h"
27 #include "unicode/utypes.h"
28
29 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
30
31 #include "unicode/localpointer.h"
32 #include "unicode/parseerr.h"
33
34 struct URegularExpression;
40 typedef struct URegularExpression URegularExpression;
41
42
47 typedef enum URegexpFlag{
48
49 #ifndef U_HIDE_DRAFT_API
50
53 UREGEX_CANON_EQ = 128,
54 #endif /* U_HIDE_DRAFT_API */
55
56 UREGEX_CASE_INSENSITIVE = 2,
57
59 UREGEX_COMMENTS = 4,
60
63 UREGEX_DOTALL = 32,
64
75 UREGEX_LITERAL = 16,
76
81 UREGEX_MULTILINE = 8,
82
88 UREGEX_UNIX_LINES = 1,
89
97 UREGEX_UWORD = 256,
98
106 UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
107
108 } URegexpFlag;
109
132 U_STABLE URegularExpression * U_EXPORT2
133 uregex_open( const UChar *pattern,
134 int32_t patternLength,
135 uint32_t flags,
136 UParseError *pe,
137 UErrorCode *status);
138
162 U_STABLE URegularExpression * U_EXPORT2
163 uregex_openUText(UText *pattern,
164 uint32_t flags,
165 UParseError *pe,
166 UErrorCode *status);
167
191 #if !UCONFIG_NO_CONVERSION
192 U_STABLE URegularExpression * U_EXPORT2
193 uregex_openC( const char *pattern,
194 uint32_t flags,
195 UParseError *pe,
196 UErrorCode *status);
197 #endif
198
199
200
208 U_STABLE void U_EXPORT2
209 uregex_close(URegularExpression *regexp);
210
211 #if U_SHOW_CPLUSPLUS_API
212
213 U_NAMESPACE_BEGIN
214
224 U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
225
226 U_NAMESPACE_END
227
228 #endif
229
248 U_STABLE URegularExpression * U_EXPORT2
249 uregex_clone(const URegularExpression *regexp, UErrorCode *status);
250
268 U_STABLE const UChar * U_EXPORT2
269 uregex_pattern(const URegularExpression *regexp,
270 int32_t *patLength,
271 UErrorCode *status);
272
284 U_STABLE UText * U_EXPORT2
285 uregex_patternUText(const URegularExpression *regexp,
286 UErrorCode *status);
287
296 U_STABLE int32_t U_EXPORT2
297 uregex_flags(const URegularExpression *regexp,
298 UErrorCode *status);
299
300
321 U_STABLE void U_EXPORT2
322 uregex_setText(URegularExpression *regexp,
323 const UChar *text,
324 int32_t textLength,
325 UErrorCode *status);
326
327
344 U_STABLE void U_EXPORT2
345 uregex_setUText(URegularExpression *regexp,
346 UText *text,
347 UErrorCode *status);
348
369 U_STABLE const UChar * U_EXPORT2
370 uregex_getText(URegularExpression *regexp,
371 int32_t *textLength,
372 UErrorCode *status);
373
390 U_STABLE UText * U_EXPORT2
391 uregex_getUText(URegularExpression *regexp,
392 UText *dest,
393 UErrorCode *status);
394
420 U_STABLE void U_EXPORT2
421 uregex_refreshUText(URegularExpression *regexp,
422 UText *text,
423 UErrorCode *status);
424
445 U_STABLE UBool U_EXPORT2
446 uregex_matches(URegularExpression *regexp,
447 int32_t startIndex,
448 UErrorCode *status);
449
471 U_STABLE UBool U_EXPORT2
472 uregex_matches64(URegularExpression *regexp,
473 int64_t startIndex,
474 UErrorCode *status);
475
499 U_STABLE UBool U_EXPORT2
500 uregex_lookingAt(URegularExpression *regexp,
501 int32_t startIndex,
502 UErrorCode *status);
503
528 U_STABLE UBool U_EXPORT2
529 uregex_lookingAt64(URegularExpression *regexp,
530 int64_t startIndex,
531 UErrorCode *status);
532
552 U_STABLE UBool U_EXPORT2
553 uregex_find(URegularExpression *regexp,
554 int32_t startIndex,
555 UErrorCode *status);
556
577 U_STABLE UBool U_EXPORT2
578 uregex_find64(URegularExpression *regexp,
579 int64_t startIndex,
580 UErrorCode *status);
581
595 U_STABLE UBool U_EXPORT2
596 uregex_findNext(URegularExpression *regexp,
597 UErrorCode *status);
598
606 U_STABLE int32_t U_EXPORT2
607 uregex_groupCount(URegularExpression *regexp,
608 UErrorCode *status);
609
626 U_STABLE int32_t U_EXPORT2
627 uregex_group(URegularExpression *regexp,
628 int32_t groupNum,
629 UChar *dest,
630 int32_t destCapacity,
631 UErrorCode *status);
632
655 U_STABLE UText * U_EXPORT2
656 uregex_groupUText(URegularExpression *regexp,
657 int32_t groupNum,
658 UText *dest,
659 int64_t *groupLength,
660 UErrorCode *status);
661
662 #ifndef U_HIDE_INTERNAL_API
663
680 U_INTERNAL UText * U_EXPORT2
681 uregex_groupUTextDeep(URegularExpression *regexp,
682 int32_t groupNum,
683 UText *dest,
684 UErrorCode *status);
685 #endif /* U_HIDE_INTERNAL_API */
686
701 U_STABLE int32_t U_EXPORT2
702 uregex_start(URegularExpression *regexp,
703 int32_t groupNum,
704 UErrorCode *status);
705
721 U_STABLE int64_t U_EXPORT2
722 uregex_start64(URegularExpression *regexp,
723 int32_t groupNum,
724 UErrorCode *status);
725
739 U_STABLE int32_t U_EXPORT2
740 uregex_end(URegularExpression *regexp,
741 int32_t groupNum,
742 UErrorCode *status);
743
758 U_STABLE int64_t U_EXPORT2
759 uregex_end64(URegularExpression *regexp,
760 int32_t groupNum,
761 UErrorCode *status);
762
776 U_STABLE void U_EXPORT2
777 uregex_reset(URegularExpression *regexp,
778 int32_t index,
779 UErrorCode *status);
780
795 U_STABLE void U_EXPORT2
796 uregex_reset64(URegularExpression *regexp,
797 int64_t index,
798 UErrorCode *status);
799
820 U_STABLE void U_EXPORT2
821 uregex_setRegion(URegularExpression *regexp,
822 int32_t regionStart,
823 int32_t regionLimit,
824 UErrorCode *status);
825
847 U_STABLE void U_EXPORT2
848 uregex_setRegion64(URegularExpression *regexp,
849 int64_t regionStart,
850 int64_t regionLimit,
851 UErrorCode *status);
852
867 U_STABLE void U_EXPORT2
868 uregex_setRegionAndStart(URegularExpression *regexp,
869 int64_t regionStart,
870 int64_t regionLimit,
871 int64_t startIndex,
872 UErrorCode *status);
873
883 U_STABLE int32_t U_EXPORT2
884 uregex_regionStart(const URegularExpression *regexp,
885 UErrorCode *status);
886
897 U_STABLE int64_t U_EXPORT2
898 uregex_regionStart64(const URegularExpression *regexp,
899 UErrorCode *status);
900
911 U_STABLE int32_t U_EXPORT2
912 uregex_regionEnd(const URegularExpression *regexp,
913 UErrorCode *status);
914
926 U_STABLE int64_t U_EXPORT2
927 uregex_regionEnd64(const URegularExpression *regexp,
928 UErrorCode *status);
929
940 U_STABLE UBool U_EXPORT2
941 uregex_hasTransparentBounds(const URegularExpression *regexp,
942 UErrorCode *status);
943
944
964 U_STABLE void U_EXPORT2
965 uregex_useTransparentBounds(URegularExpression *regexp,
966 UBool b,
967 UErrorCode *status);
968
969
979 U_STABLE UBool U_EXPORT2
980 uregex_hasAnchoringBounds(const URegularExpression *regexp,
981 UErrorCode *status);
982
983
997 U_STABLE void U_EXPORT2
998 uregex_useAnchoringBounds(URegularExpression *regexp,
999 UBool b,
1000 UErrorCode *status);
1001
1012 U_STABLE UBool U_EXPORT2
1013 uregex_hitEnd(const URegularExpression *regexp,
1014 UErrorCode *status);
1015
1027 U_STABLE UBool U_EXPORT2
1028 uregex_requireEnd(const URegularExpression *regexp,
1029 UErrorCode *status);
1030
1031
1032
1033
1034
1059 U_STABLE int32_t U_EXPORT2
1060 uregex_replaceAll(URegularExpression *regexp,
1061 const UChar *replacementText,
1062 int32_t replacementLength,
1063 UChar *destBuf,
1064 int32_t destCapacity,
1065 UErrorCode *status);
1066
1088 U_STABLE UText * U_EXPORT2
1089 uregex_replaceAllUText(URegularExpression *regexp,
1090 UText *replacement,
1091 UText *dest,
1092 UErrorCode *status);
1093
1118 U_STABLE int32_t U_EXPORT2
1119 uregex_replaceFirst(URegularExpression *regexp,
1120 const UChar *replacementText,
1121 int32_t replacementLength,
1122 UChar *destBuf,
1123 int32_t destCapacity,
1124 UErrorCode *status);
1125
1147 U_STABLE UText * U_EXPORT2
1148 uregex_replaceFirstUText(URegularExpression *regexp,
1149 UText *replacement,
1150 UText *dest,
1151 UErrorCode *status);
1152
1199 U_STABLE int32_t U_EXPORT2
1200 uregex_appendReplacement(URegularExpression *regexp,
1201 const UChar *replacementText,
1202 int32_t replacementLength,
1203 UChar **destBuf,
1204 int32_t *destCapacity,
1205 UErrorCode *status);
1206
1229 U_STABLE void U_EXPORT2
1230 uregex_appendReplacementUText(URegularExpression *regexp,
1231 UText *replacementText,
1232 UText *dest,
1233 UErrorCode *status);
1234
1259 U_STABLE int32_t U_EXPORT2
1260 uregex_appendTail(URegularExpression *regexp,
1261 UChar **destBuf,
1262 int32_t *destCapacity,
1263 UErrorCode *status);
1264
1283 U_STABLE UText * U_EXPORT2
1284 uregex_appendTailUText(URegularExpression *regexp,
1285 UText *dest,
1286 UErrorCode *status);
1287
1339 U_STABLE int32_t U_EXPORT2
1340 uregex_split( URegularExpression *regexp,
1341 UChar *destBuf,
1342 int32_t destCapacity,
1343 int32_t *requiredCapacity,
1344 UChar *destFields[],
1345 int32_t destFieldsCapacity,
1346 UErrorCode *status);
1347
1374 U_STABLE int32_t U_EXPORT2
1375 uregex_splitUText(URegularExpression *regexp,
1376 UText *destFields[],
1377 int32_t destFieldsCapacity,
1378 UErrorCode *status);
1379
1402 U_STABLE void U_EXPORT2
1403 uregex_setTimeLimit(URegularExpression *regexp,
1404 int32_t limit,
1405 UErrorCode *status);
1406
1416 U_STABLE int32_t U_EXPORT2
1417 uregex_getTimeLimit(const URegularExpression *regexp,
1418 UErrorCode *status);
1419
1440 U_STABLE void U_EXPORT2
1441 uregex_setStackLimit(URegularExpression *regexp,
1442 int32_t limit,
1443 UErrorCode *status);
1444
1452 U_STABLE int32_t U_EXPORT2
1453 uregex_getStackLimit(const URegularExpression *regexp,
1454 UErrorCode *status);
1455
1456
1475 U_CDECL_BEGIN
1476 typedef UBool U_CALLCONV URegexMatchCallback (
1477 const void *context,
1478 int32_t steps);
1479 U_CDECL_END
1480
1495 U_STABLE void U_EXPORT2
1496 uregex_setMatchCallback(URegularExpression *regexp,
1497 URegexMatchCallback *callback,
1498 const void *context,
1499 UErrorCode *status);
1500
1501
1513 U_STABLE void U_EXPORT2
1514 uregex_getMatchCallback(const URegularExpression *regexp,
1515 URegexMatchCallback **callback,
1516 const void **context,
1517 UErrorCode *status);
1518
1549 U_CDECL_BEGIN
1550 typedef UBool U_CALLCONV URegexFindProgressCallback (
1551 const void *context,
1552 int64_t matchIndex);
1553 U_CDECL_END
1554
1555
1567 U_STABLE void U_EXPORT2
1568 uregex_setFindProgressCallback(URegularExpression *regexp,
1569 URegexFindProgressCallback *callback,
1570 const void *context,
1571 UErrorCode *status);
1572
1584 U_STABLE void U_EXPORT2
1585 uregex_getFindProgressCallback(const URegularExpression *regexp,
1586 URegexFindProgressCallback **callback,
1587 const void **context,
1588 UErrorCode *status);
1589
1590 #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
1591 #endif /* UREGEX_H */