मैं तिथियों के विभिन्न पैटर्न से मेल खाने के लिए निम्न रेगेक्स का उपयोग कर रहा हूं। यह regex101.com में ठीक काम करता है। लेकिन जब मैं अजगर में आयात करता हूं तो मुझे "खराब चरित्र सीमा" अपवाद मिल रहा है।पायथन रेगेक्स खराब चरित्र सीमा।
pattern = ur"((?:\b((?:(january|jan|february|feb|march|mar|april|apr|may|jun|june|july|jul|august|aug|september|set|sep|october|oct|november|nov|december|dec)['\s\.]{0,4}(?:\d{4}|\d{2})|(?:january|jan|february|feb|march|mar|april|apr|may|jun|june|july|jul|august|aug|september|set|sep|october|oct|november|nov|december|dec)|((?:0[1-9]|[1-3][0-9]|[0-9])/(?:0[1-9]|[1-3][0-9])/(?:(19[7-9][0-9])|(20[0-1][0-9])|([7-9][0-9]|[0-1][0-9]))|((?:0[1-9]|1[0-2]|[1-9])\s{0,3}[-/']{1,3}[\s-/']{0,3}(?:(19[7-9][0-9])|(20[0-1][0-9])|([7-9][0-9]|[0-1][0-9])))))(?:(?![\r\n])\s){0,4})[-/–to]{0,2}(?:(?![\r\n])\s){0,4}(((?:january|jan|february|feb|march|mar|april|apr|may|jun|june|july|jul|august|aug|september|set|sep|october|oct|november|nov|december|dec)[-'\s\.]{0,4}(?:(19[7-9][0-9])|(20[0-1][0-9])|([7-9][0-9]|[0-1][0-9])))|((?:0[1-9]|[1-3][0-9]|[1-9])/(?:0[1-9]|[1-3][0-9])/(?:(19[7-9][0-9])|(20[0-1][0-9])|([7-9][0-9]|[0-1][0-9])))|((?:0[1-9]|1[0-2]|[1-9])\s{0,3}[-/']{1,3}[\s-/']{0,3}(?:(19[7-9][0-9])|(20[0-1][0-9])|([7-9][0-9]|[0-1][0-9]))))))"
https://regex101.com/r/rU3cE9/1
पाइथन का कौन सा संस्करण आप चल रहे हैं? –
@AvinashRaj - मैं बहुत सारे हाइफ़न शामिल करता हूं। मुझे संदेह है कि, यह नियमित हाइफ़न (-) के कारण नहीं होगा? लेकिन, regex101.com कैसे एक त्रुटि नहीं दिखाता है। – user3116355
@AvinashRaj - मैं अजगर का उपयोग कर रहा हूं 2.7 – user3116355