Hi,
Is it possible to search in the text by format ?
For example, there is a date in the text in the form of dd/mm/yyyy.
I need to find this fragment and determine that it is exactly the date (a la Excel - mask search "??/??/????")
Search by format
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Search by format
Use RegEx
Example:
Example:
Code: Select all | Expand
cRegExDate := "[0-3][0-9][-|/|.][0-1][0-9][-|/|.][1-2][0-9][0-9][0-9]"
? HB_ATX( cRegExDate, "His date of birth is 20/10/1986, What is his age?" )
// result "20/10/1986"
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Search by format
Are you programming for East Asian languages?
If you are confined to English and West European languages, all characters other than accented characters are represented by a single byte (and the same byte) both in ANSI and UTF8.
So, normal RegEx expressions should work with UTF8 text also, if you are not programming for Asian languages
If you are confined to English and West European languages, all characters other than accented characters are represented by a single byte (and the same byte) both in ANSI and UTF8.
So, normal RegEx expressions should work with UTF8 text also, if you are not programming for Asian languages
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Search by format
That's not how I asked the question.
I am interested in a regular expression for a date of this format «06» April 2023 (months may be different)
![Sad :(](./images/smilies/icon_sad.gif)
I am interested in a regular expression for a date of this format «06» April 2023 (months may be different)
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Search by format
https://forums.fivetechsupport.com/view ... b2#p246040
https://forums.fivetechsupport.com/view ... b2#p219288
https://forums.fivetechsupport.com/view ... b2#p147069
https://forums.fivetechsupport.com/view ... b2#p133998
https://forums.fivetechsupport.com/view ... b2#p108243
https://forums.fivetechsupport.com/view ... 5b2#p88154
Regards, saludos.
https://forums.fivetechsupport.com/view ... b2#p219288
https://forums.fivetechsupport.com/view ... b2#p147069
https://forums.fivetechsupport.com/view ... b2#p133998
https://forums.fivetechsupport.com/view ... b2#p108243
https://forums.fivetechsupport.com/view ... 5b2#p88154
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Search by format
Code: Select all | Expand
local cRegEx := "[«][0-3][0-9][»]"
? hb_atx( cRegEx , "test this «23». working" )
Note: These are not Unicode characters.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India