How to Extend rules.js in Magento 2

javascriptmagento2rules

I try to overwrite rules.js from vendor/Magento_Ui/web/js/lib/validation/rules.js in my custom theme but it dosen't work.
I found this solution but it's not working for me : Magento 2 How to extend rules.js to add custom validation rules?

Does anyone have any idea if it's other method to overwrite rule.js file?

Best Answer

In your case, you need to create a custom theme. You should read more here: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

Put the validation rule in your custom theme with following path:

app/design/frontend/Package/themename/Magento_Ui/web/js/lib/validation/rules.js

enter image description here