473,698 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript validation for wildcard in string

2 New Member
Hi,
I am new to javascript, I need your help in javascript validation of a string.
string of length 6,
last 4 characters can be padded with "8" while entering.
valid strings are
ZJJL74
ZJJL7*
ZJJL**
ZJJ***
ZJ****

Invalid strings are
ZJ*L74
ZJJ*7*
*JJL**
Z*****
*****4
this means * cannot be entered in the middle,
it can be entered only at the end maximum up to last 4 characters.
please provide the solution ASAP, will be very grateful
Sep 17 '09 #1
3 2788
RamananKalirajan
608 Contributor
try using indexOf() function that will give you the solution what you are looking for...

Thanks and Regards
Ramanan Kalirajan
Sep 17 '09 #2
gayuvinu
2 New Member
can you please give the function with an example
Sep 17 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
why is everyone always wanting the code?

you could also try an RegExp. (you’ll probably need the look-ahead and/or look-before groups (?=, ?!, ?<=, ?<!))
Sep 17 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2683
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
1
3223
by: Generic Usenet Account | last post by:
Here's the requirement that I am trying to satisfy: Handle wildcards in STL such that the wildcard entry is encountered before non-wildcard entries while traversing containers like sets and maps. I have come up with two approaches, one using inheritance and the other using composition. I am unable to decide which one is better. The sample source code follows.
4
9468
by: Madha K | last post by:
I am developing a web application that need to support UTF-8 characters. For client side validations, can javascript be used to handle UTF-8 characters. 1) How javascript can be used to restrict non-utf8 characters? 2) Using javascript how to find the lengh of a string having unicode characters? e.g: For a field Name on the form, there is a corrosponding field Name varchar2(10) in DB. Through my application when i try enter 10 normal...
136
9379
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
3
2234
by: Kent Ogletree | last post by:
I am porting a Java XML Validation class over to C# and I am having a problem finding exactly what I need to acomplish the task. First I need to test for well formedness. I know this is usually something that does not need to be done, however in this case it is required. Is the best way to do this to validate to the schema and if no exception is thrown it must be well formed? What exception would be thrown if the document is found to not...
1
7272
by: deko | last post by:
I have a form where users can enter a string with asterisks to perform a wildcard search. Currently, the string entered by the user looks like this: *somestring* The purpose is to match any database field containing "somestring". Is there a way to avoid the need for the asterisks? This would make it easier for the users and also I wouldn't have to explain that asterisks are required when performing a wildcard search.
2
2757
by: Diffident | last post by:
Hello All, ASP.NET 1.1 and Visual Studio 2003. I have a page which has few datagrids, validation controls and other server controls. When the page is rendered in the browser I am seeing a javascript error at the very bottom of the page. I am not using any custom javascript code except for what is inherently generated by .NET framework. When I tried debugging the javascript error using debugging tools for
5
1911
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked. I have to use Stringbuilder to do this: Dim iCount As Int32 Dim sClientSideValidate As New StringBuilder
9
2406
by: hendedav | last post by:
Gang, I am trying to get a regular expression test to work and can't figure out why. I will give you the code below: for (var j=0; j<document.getElementById('cmbList').options.length; j+ +) { if (document.getElementById('cmbList').options.value ==
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.