/    Sign up×
Community /Pin to ProfileBookmark

Stripping characters from user input

How would I change the following script to strip the following characters from the user input –

[code]$,.[/code]

[code]<!–Begin

function answer() {
var emptyPocketsOne = document.calc.regex.value.match(/Empty Pockets: (d*)/);
var usedPocketsOne = document.calc.regex.value.match(/Used Pockets: (d*)/);
var labSpaceOne = document.calc.regex.value.match(/Drug Lab Size: (d*)/);
var junkiesOne = document.calc.regex.value.match(/Working Junkies: (d*)/);
var junkiesTwo = document.calc.regex.value.match(/Training Junkies: (d*)/);
var totalJunkiesOne = parseInt(junkiesOne[1]) + parseInt(junkiesTwo[1]);
var coatOne = parseInt(usedPocketsOne[1]) + parseInt(emptyPocketsOne[1]);
var emptyPocketsTwo = document.calc.regex.value.match(/Empty Pockets: (d*)/);
var usedPocketsTwo = document.calc.regex.value.match(/Used Pockets: (d*)/);
var labSpaceTwo = document.calc.regex.value.match(/Drug Lab Size: (d*)/);
var junkiesThree = document.calc.regex.value.match(/Working Junkies: (d*)/);
var junkiesFour = document.calc.regex.value.match(/Training Junkies: (d*)/);
var totalJunkiesTwo = parseInt(junkiesThree[1]) + parseInt(junkiesFour[1]);
var coatTwo = parseInt(usedPocketsTwo[1]) + parseInt(emptyPocketsTwo[1]);

var resultOne = 0;
while (usedPocketsOne[1] > totalJunkiesOne – labSpaceOne[1] * 17) {
resultOne = resultOne + 1;
usedPocketsOne[1] = usedPocketsOne[1] – totalJunkiesOne + labSpaceOne[1] * 17;
totalJunkiesOne = totalJunkiesOne + 1;
}

var resultTwo = 0;
while (usedPocketsTwo[1] > totalJunkiesTwo – labSpaceTwo[1] * 17) {
resultTwo = resultTwo + 1;
usedPocketsTwo[1] = usedPocketsTwo[1] – totalJunkiesTwo + labSpaceTwo[1] * 17;
}

var visitsOne = document.calc.regex.value.match(/Dealer Visits Remaining: (d*)/);
if (visitsOne[1] == 0) {
resultOne = resultOne – 2;
usedPocketsOne[1] = usedPocketsOne[1] + 1;
}

var visitsTwo = document.calc.regex.value.match(/Dealer Visits Remaining: (d*)/);
if (visitsTwo[1] == 0) {
resultTwo = resultTwo – 2;
usedPocketsTwo[1] = usedPocketsTwo[1] + 1;
}

alert(resultOne);
}

// End–>[/code]

Thanks in advance ?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @NaZKYN spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...