I have a continuous form in access 2003 on which i need to perform validation using regular expressions in textboxes. I want to call the validation using a button click. I want to use constracts similar to conditional formatting in vba for regular expresions on th textboxes used on th form.
Please suugest pointers for direction on how to do it. If you have a code snippet doin it, request to share.
Conditional Formatting doesn't support Regex directly. You would need to create a user-defined function (UDF) in VBA. For example:
Function FormatSalary(varField As Variant) As Boolean
FormatSalary = (varField) > 20000
End Function
This Function would use Regex before returning True or False. In the Conditional Formatting rule for the field, you would use Expression is and enter:
FormatSalary([Salary])
notice that there is no equals-sign preceding this.
You can, I believe, do this programmatically when clicking a button, working with the FormatConditions collection in VBA. However, I suspect that you might need to switch the form back and forth to Design View. (I haven't tried this recently.)
Related
So basically I have some python scripts with strings representing SQL statements with some named arguments, eg:
schdl_stmt = "select * from bar.schedule where date = '{date}'"
I uses this to interpolate the date dynamically.
My workflow involves running/debugging these queries in DataGrip, and so I really need a way for DataGrip to utilize this named argument syntax, else I'm stuck manually editing the statement too often.
DataGrip allows you to add custom regex patterns for such a usecase in the settings pictured below:
However I have not been able to figure out one that works for the Python named argument string pattern.
I've tried:
"{name}"
"\{name\}"
If it's simply not possible because of some caveat with how DataGrip handle's these patterns, that would be useful to know as well.
The correct pattern is
\{(\w+)\}
with 'Substitute inside SQL strings' enabled.
Please read this document for more details.
I am trying to make a Regular Expression on Google Tag Manager, more specific in a trigger. The trick is this: the url that I need to filter have this type of url: webpage.com/checkout/#/some_parameter, but I have been trying different options, without success.
The options that I tried are:
checkout\/[#] or checkout\/[^a-z][^A-Z], and other expressions without any success. I used the preview mode, but the trigger doesn't activate, no matter what I try.
Anyone have an idea on what is happening?
Thanks.
If you want to check for the value after the hashtag I suggest you dispense with the regex. Instead you create an URL type variable and set "component type" to "fragment". This will return the value after the hashmark. You can now use that in your rules, e.g. set an exception trigger if the fragment value is some_parameters.
If the presence of any hash mark serves as exception you should be able to set a condition "PAGE URL does not contain #", again without using regex.
I often invoke functions from my menu
Many have double entries:
- one for normal substitution
- one for subsitution with confirmation dialog (gc)
p.e.:
vnoreme 20.900 &Edit.Delete\ All\ but\ 1st\ Doubles\ :<C-U>call <SID>DeleteD("'<,'>","confirm-no")<CR>
vnoreme 20.901 &Edit.Delete\ All\ but\ 1st\ Doubles\ (gc)\ :<C-U>call <SID>DeleteD("'<,'>","confirm-yes")<CR>
Is there no better way then the one I use above to indicate a confirmation dialog?
(and to avoid all these double entries)
P.e. when a function invokes an inputdialog box, I would like to have a checkbox added where I can indicate (checking it) to add a dialog confirmation after every substitution, but unfortunately they don't exist and there is no way (as in autohotkey) to create an inputdialog GUI myself.
Well, you could change your Delete() function to ask you, whether you'd like to have each substitution being confirmed. Something like this:
fu! Delete(range)
let confirm = confirm("confirm each change?", "&yes\n&no", 1)
let cmd=printf("%ss/foobar/foobaz/g%s", a:range, confirm ? 'c' : '')
exe cmd
endfu
(this is just an example, you probably want to change at least the search and replace criteria)
Or, if you are using a simple substitution, learn to use the :ex command :promptrepl,
e.g. :promptrepl foobar will open a search/replace dialog where the search field will be set to 'foobar' and you only need to enter the replacement part and hit the buttons you like.
Would someone kindly help me understand this property. Below is their explanation:
<ig:TextColumn.FilterColumnSettings>
<ig:FilterColumnSettings FilterMenuFormatString="{}{Regex}"/>
</ig:TextColumn.FilterColumnSettings>
When you are applying the format through XAML and using special symbols in it you should escape it with {}.
I don't understand how to translate this to a pattern and replace. I'd like to replace the first underscore in the string with a double underscore (trying to defeat the RecognizesAccessKey behavior of the checkbox, without creating a new control template).
The FilterMenuFormatString allows you to apply a FormatString to the values displayed in the filter list similar to what the String.Format method does.
Note that the behavior that you are trying to workaround will be addressed in the Next NetAdvantage for WPF/Silverlight service release which is currently scheduled for April 5th according to the release schedule.
If you need to workaround the behavior before then you can use the workaround suggested on the Infragistics forums to set the RecognizesAccessKey of the ContentPresenter to false in the default templates.
Say I request
parent/child/child/page-name
in my browser. I want to extract the parent, children as well as page name. Here are the regular expressions I am currently using. There should be no limit as to how many children there are in the url request. For the time being, the page name will always be at the end and never be omitted.
^([\w-]{1,}){1} -> Match parent (returns 'parent')
(/(?:(?!/).)*[a-z]){1,}/ -> Match children (returns /child/child/)
[\w-]{1,}(?!.*[\w-]{1,}) -> Match page name (returns 'page-name')
The more I play with this, the more I feel how clunky this solution is. This is for a small CMS I am developing in ASP Classic (:(). It is sort of like the MVC routing paths. But instead of calling controllers and functions based on the URL request. I would be travelling down the hierarchy and finding the appropriate page in the database. The database is using the nested set model and is linked by a unique page name for each child.
I have tried using the split function to split with a / delimiter however I found I was nested so many split statements together it became very unreadable.
All said, I need an efficient way to parse out the parent, children as well as page name from a string. Could someone please provide an alternative solution?
To be honest, I'm not even sure if a regular expression is the best solution to my problem.
Thank you.
You could try using:
^([\w-]+)(/.*/)([\w-]+)$
And then access the three matching groups created using Match.SubMatches. See here for more details.
EDIT
Actually, assuming that you know that [\w-] is all that is used in the names of the parts, you can use ^([\w-]+)(.*)([\w-]+)$ instead and it will handle the no-child case fine by itself as well.